[EMAIL PROTECTED] wrote:
Tag: cws_src680_jl46
User: jl
Date: 2006/10/26 03:54:03
Modified:
porting/sal/systools/win32/guistdio/guistdio.inc
Log:
#i69173# unopkg.com did not print out the full help text
File Changes:
Directory: /porting/sal/systools/win32/guistdio/
================================================
File [changed]: guistdio.inc
Url:
http://porting.openoffice.org/source/browse/porting/sal/systools/win32/guistdio/guistdio.inc?r1=1.1.2.1&r2=1.1.2.2
Delta lines: +13 -4
--------------------
--- guistdio.inc 21 Sep 2006 15:24:47 -0000 1.1.2.1
+++ guistdio.inc 26 Oct 2006 10:54:00 -0000 1.1.2.2
@@ -4,9 +4,9 @@
*
* $RCSfile: guistdio.inc,v $
*
- * $Revision: 1.1.2.1 $
+ * $Revision: 1.1.2.2 $
*
- * last change: $Author: hro $ $Date: 2006/09/21 15:24:47 $
+ * last change: $Author: jl $ $Date: 2006/10/26 10:54:00 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -286,6 +286,15 @@
}
} 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 GUISTDIO_KEEPRUNNING
+ Sleep(1000);
+#endif
CloseHandle( hOutputThread );
CloseHandle( hErrorThread );
CloseHandle( hInputThread );
I *guess* that the problem rather is in the do loop above that code,
which might exit prematurely when "The child process has terminated"
comes in before "The remote end of stdout pipe was closed" or "The
remote end of stderr pipe was closed."
sal/systools/win32/guistdio/guistdio.cxx:1.5 l. 269--288:
---8<---
do
{
dwWaitResult = WaitForMultipleObjects( elementsof(hObjects),
hObjects, FALSE, INFINITE );
switch ( dwWaitResult )
{
case WAIT_OBJECT_0: // The child process has terminated
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
bDetach = --nOpenPipes <= 0;
break;
default: // Something went wrong
bDetach = true;
break;
}
} while( !bDetach );
---8<---
-Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]