Skip to content
Tcl Source Code Artifact [a564ebf09f]
Login

Artifact [a564ebf09f]

Artifact a564ebf09fb1722191b1ec15e2b08764801e5ee6:

Attachment "patch.txt" to ticket [947693ffff] added by davygrvy on 2004-06-03 02:49:10.
Index: tclWinPipe.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinPipe.c,v
retrieving revision 1.48
diff -c -r1.48 tclWinPipe.c
*** tclWinPipe.c	30 May 2004 21:57:09 -0000	1.48
--- tclWinPipe.c	2 Jun 2004 19:45:46 -0000
***************
*** 1884,1889 ****
--- 1884,1891 ----
      DWORD exitCode;
  
      errorCode = 0;
+     result = 0;
+ 
      if ((!flags || (flags == TCL_CLOSE_READ))
  	    && (pipePtr->readFile != NULL)) {
  	/*
***************
*** 2044,2067 ****
  	}
      }
  
!     /*
!      * 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);
  
      if (pipePtr->numPids > 0) {
          ckfree((char *) pipePtr->pidPtr);
--- 2046,2084 ----
  	}
      }
  
!     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.
!          */
!         
!         Tcl_DetachPids(pipePtr->numPids, pipePtr->pidPtr);
!         Tcl_ReapDetachedProcs();
! 
!         if (pipePtr->errorFile) {
! 	    TclpCloseFile(pipePtr->errorFile);
!         }
!     } 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);
!     }
  
      if (pipePtr->numPids > 0) {
          ckfree((char *) pipePtr->pidPtr);