diff options
author | Oliver Bolte <obo@openoffice.org> | 2009-02-12 11:44:09 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2009-02-12 11:44:09 +0000 |
commit | 3574a164c6225874afbc8ce9d67a67ad018883a7 (patch) | |
tree | 052a56580272f375fd4401faa650c45da655a20e /desktop/win32/source | |
parent | 200ee8540f8f033cdef497822486db823d668613 (diff) |
CWS-TOOLING: integrate CWS jl115
2009-01-29 13:13:16 +0100 jsk r267121 : #i98596#
2009-01-23 14:50:24 +0100 jl r266821 : #98273# climaker.exe.config prevents using publisher policy
2009-01-23 14:10:51 +0100 jl r266817 : #i98392# wrong use of iterator when removing a factory, which may lead to a crash
2009-01-19 11:36:29 +0100 jl r266484 : #i96690# test extension
2009-01-19 11:32:46 +0100 jl r266483 : #i96690#
2009-01-16 17:09:19 +0100 jl r266439 : #i96690# ignore duplicate path URLs in manifest.xml. These may be introduces by copy/paste and lead to nasty errors
2009-01-16 14:04:00 +0100 jl r266416 : #i92032# increasing minimum version of Java
2009-01-16 10:57:02 +0100 jl r266407 : #i96816# compiler warning breaks build
2009-01-15 16:58:54 +0100 jl r266384 : #i94938# patch from cmc.
2009-01-15 16:35:18 +0100 jl r266383 : #i95838# applying patch
2009-01-15 16:15:58 +0100 jl r266381 : #i70855# #i96102# WaitForMultipleObjects wrong implemented
2009-01-14 12:46:21 +0100 jl r266287 : #i98038# increased assembly versions
2009-01-14 12:44:55 +0100 jl r266285 : #i98038# increased assembly versions
2009-01-13 17:11:20 +0100 jl r266239 : #i98038# new test library for assemblies from 3.0.1
Diffstat (limited to 'desktop/win32/source')
-rw-r--r-- | desktop/win32/source/guistdio/guistdio.inc | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/desktop/win32/source/guistdio/guistdio.inc b/desktop/win32/source/guistdio/guistdio.inc index 3cd650ad7c..c8170e6948 100644 --- a/desktop/win32/source/guistdio/guistdio.inc +++ b/desktop/win32/source/guistdio/guistdio.inc @@ -45,6 +45,8 @@ #include <stdlib.h> #include <systools/win32/uwinapi.h> +#include <stdio.h> + //--------------------------------------------------------------------------- // Thread that reads from child process standard output pipe //--------------------------------------------------------------------------- @@ -214,9 +216,7 @@ DWORD WINAPI WaitForUIThread( LPVOID pParam ) #ifndef UNOPKG if ( !_tgetenv( TEXT("UNOPKG") ) ) WaitForInputIdle( hProcess, INFINITE ); - else #endif - WaitForSingleObject( hProcess, INFINITE ); return 0; } @@ -353,17 +353,19 @@ int _tmain( int, _TCHAR ** ) HANDLE hWaitForUIThread = CreateThread( NULL, 0, WaitForUIThread, (LPVOID)aProcessInfo.hProcess, 0, &dwWaitForUIThreadId ); DWORD dwWaitResult; - bool bDetach = false; - int nOpenPipes = 3; HANDLE hObjects[] = { hTargetProcess, hWaitForUIThread, - hInputThread, hOutputThread, hErrorThread }; + #ifdef GUISTDIO_KEEPRUNNING + dwWaitResult = WaitForMultipleObjects( elementsof(hObjects), hObjects, TRUE, INFINITE ); + #else + bool bDetach = false; + int nOpenPipes = 2; do { dwWaitResult = WaitForMultipleObjects( elementsof(hObjects), hObjects, FALSE, INFINITE ); @@ -374,9 +376,8 @@ int _tmain( int, _TCHAR ** ) case WAIT_OBJECT_0 + 1: // The child process entered input idle bDetach = true; break; - case WAIT_OBJECT_0 + 2: // The remote end of stdin pipe was closed - case WAIT_OBJECT_0 + 3: // The remote end of stdout pipe was closed - case WAIT_OBJECT_0 + 4: // The remote end of stderr pipe was closed + case WAIT_OBJECT_0 + 2: // The remote end of stdout pipe was closed + case WAIT_OBJECT_0 + 3: // The remote end of stderr pipe was closed bDetach = --nOpenPipes <= 0; break; default: // Something went wrong @@ -385,15 +386,8 @@ int _tmain( int, _TCHAR ** ) } } while( !bDetach ); - //Even if the child process terminates it is not garanteed that all three pipe threads terminate - //as tests have proven. The loop above will be typically terminate because the process has - //terminated. Then the pipe threads may not have read all data from the pipes yet. When we close - //the threads then data may be lost. For example running unopkg without arguments shall print out - //the help text. Without this workaround some text would be missing. - //ifdef only for unopkg -#ifdef UNOPKG - Sleep(1000); -#endif +#endif + CloseHandle( hOutputThread ); CloseHandle( hErrorThread ); CloseHandle( hInputThread ); |