diff options
author | davygrvy <davygrvy@noemail.net> | 2002-12-17 02:47:38 (GMT) |
---|---|---|
committer | davygrvy <davygrvy@noemail.net> | 2002-12-17 02:47:38 (GMT) |
commit | 170fea142c229b2529e5c9a97d32307d65dc36e9 (patch) | |
tree | b0fb63ee0afd303f5cf38f33ad6b51f21b5830c1 /generic | |
parent | 456a333760f4414f306618a7deb3fffaa01984ec (diff) | |
download | tcl-170fea142c229b2529e5c9a97d32307d65dc36e9.zip tcl-170fea142c229b2529e5c9a97d32307d65dc36e9.tar.gz tcl-170fea142c229b2529e5c9a97d32307d65dc36e9.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..
FossilOrigin-Name: d03e2a5a909616d6a700ce5d017ec4c91d27af5c
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclPipe.c | 12 |
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)); |