diff options
author | Kevin B Kenny <kennykb@acm.org> | 2005-06-21 19:07:31 (GMT) |
---|---|---|
committer | Kevin B Kenny <kennykb@acm.org> | 2005-06-21 19:07:31 (GMT) |
commit | 0a8e0f35a2edeb0b51aef1e06df239c2c64ef776 (patch) | |
tree | 18e123dde9ce1dd8a78bc5619332b12bb843b6d1 /win | |
parent | 2e99120257a8ebe71af4bcfeab8cc1d031a4bd24 (diff) | |
download | tcl-0a8e0f35a2edeb0b51aef1e06df239c2c64ef776.zip tcl-0a8e0f35a2edeb0b51aef1e06df239c2c64ef776.tar.gz tcl-0a8e0f35a2edeb0b51aef1e06df239c2c64ef776.tar.bz2 |
bugs 1194458 and 1225044
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinPipe.c | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 0206ac5..8dfc2ad 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinPipe.c,v 1.33.2.10 2005/04/19 16:28:22 davygrvy Exp $ + * RCS: @(#) $Id: tclWinPipe.c,v 1.33.2.11 2005/06/21 19:07:58 kennykb Exp $ */ #include "tclWinInt.h" @@ -2046,42 +2046,27 @@ PipeClose2Proc( } } - if ((pipePtr->flags & PIPE_ASYNC) || TclInExit()) { - /* - * If the channel is non-blocking or Tcl is being cleaned up, - * just detach the children PIDs, reap them (important if we are - * in a dynamic load module), and discard the errorFile. - */ + /* + * Wrap the error file into a channel and give it to the cleanup + * routine. + */ - Tcl_DetachPids(pipePtr->numPids, pipePtr->pidPtr); - Tcl_ReapDetachedProcs(); + if (pipePtr->errorFile) { + WinFile *filePtr; - if (pipePtr->errorFile) { - TclpCloseFile(pipePtr->errorFile); - } + filePtr = (WinFile*)pipePtr->errorFile; + errChan = Tcl_MakeFileChannel((ClientData) filePtr->handle, + TCL_READABLE); + ckfree((char *) filePtr); } else { - /* - * Wrap the error file into a channel and give it to the cleanup - * routine. - */ - - if (pipePtr->errorFile) { - WinFile *filePtr; - - filePtr = (WinFile*)pipePtr->errorFile; - errChan = Tcl_MakeFileChannel((ClientData) filePtr->handle, - TCL_READABLE); - ckfree((char *) filePtr); - } else { - errChan = NULL; - } - - result = TclCleanupChildren(interp, pipePtr->numPids, - pipePtr->pidPtr, errChan); + errChan = NULL; } + result = TclCleanupChildren(interp, pipePtr->numPids, pipePtr->pidPtr, + errChan); + if (pipePtr->numPids > 0) { - ckfree((char *) pipePtr->pidPtr); + ckfree((char *) pipePtr->pidPtr); } if (pipePtr->writeBuf != NULL) { @@ -2091,7 +2076,7 @@ PipeClose2Proc( ckfree((char*) pipePtr); if (errorCode == 0) { - return result; + return result; } return errorCode; } |