summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordavygrvy <davygrvy@pobox.com>2002-12-17 02:47:38 (GMT)
committerdavygrvy <davygrvy@pobox.com>2002-12-17 02:47:38 (GMT)
commit8fd397ee9ff91c143248a1ad2d38a15501f42489 (patch)
treeb0fb63ee0afd303f5cf38f33ad6b51f21b5830c1 /generic
parent769a60101291f798e16b5919ab9f5879806ccd37 (diff)
downloadtcl-8fd397ee9ff91c143248a1ad2d38a15501f42489.zip
tcl-8fd397ee9ff91c143248a1ad2d38a15501f42489.tar.gz
tcl-8fd397ee9ff91c143248a1ad2d38a15501f42489.tar.bz2
* generic/tclPipe.c (TclCleanupChildren):
* tests/winPipe.c: * win/tclWinPipe.c (Tcl_WaitPid): * win/tclWinTest.c: Gave Tcl_WaitPid the ability to return a Win32 exception code translated into a posix style SIG*. This allows [close] to report "CHILDKILLED" without the meaning getting lost in a truncated exit code. In TclCleanupChildren(), TclpGetPid() had to get moved to before Tcl_WaitPid() as the the handle is removed from the list taking away the ability to get the process id after the wait is done. This shouldn't effect the unix implimentaion unless waitpid is called with a pid of zero, meaning "any". I don't think it is..
Diffstat (limited to 'generic')
-rw-r--r--generic/tclPipe.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/generic/tclPipe.c b/generic/tclPipe.c
index 5365047..7d1334d 100644
--- a/generic/tclPipe.c
+++ b/generic/tclPipe.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclPipe.c,v 1.6 2002/02/15 14:28:49 dkf Exp $
+ * RCS: @(#) $Id: tclPipe.c,v 1.7 2002/12/17 02:47:39 davygrvy Exp $
*/
#include "tclInt.h"
@@ -280,9 +280,17 @@ TclCleanupChildren(interp, numPids, pidPtr, errorChan)
Tcl_Pid pid;
WAIT_STATUS_TYPE waitStatus;
CONST char *msg;
+ unsigned long resolvedPid;
abnormalExit = 0;
for (i = 0; i < numPids; i++) {
+ /*
+ * We need to get the resolved pid before we wait on it as
+ * the windows implimentation of Tcl_WaitPid deletes the
+ * information such that any following calls to TclpGetPid
+ * fail.
+ */
+ resolvedPid = TclpGetPid(pidPtr[i]);
pid = Tcl_WaitPid(pidPtr[i], (int *) &waitStatus, 0);
if (pid == (Tcl_Pid) -1) {
result = TCL_ERROR;
@@ -315,7 +323,7 @@ TclCleanupChildren(interp, numPids, pidPtr, errorChan)
char msg1[TCL_INTEGER_SPACE], msg2[TCL_INTEGER_SPACE];
result = TCL_ERROR;
- TclFormatInt(msg1, (long) TclpGetPid(pid));
+ TclFormatInt(msg1, (long) resolvedPid);
if (WIFEXITED(waitStatus)) {
if (interp != (Tcl_Interp *) NULL) {
TclFormatInt(msg2, WEXITSTATUS(waitStatus));