diff options
Diffstat (limited to 'win/tclWinPipe.c')
-rw-r--r-- | win/tclWinPipe.c | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 76695e0..8194f64 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.3 1998/09/14 18:40:20 stanton Exp $ + * RCS: @(#) $Id: tclWinPipe.c,v 1.4 1999/03/11 00:19:24 stanton Exp $ */ #include "tclWinInt.h" @@ -998,11 +998,7 @@ TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile, } *pidPtr = (Tcl_Pid) procInfo.hProcess; if (*pidPtr != 0) { - ProcInfo *procPtr = (ProcInfo *) ckalloc(sizeof(ProcInfo)); - procPtr->hProcess = procInfo.hProcess; - procPtr->dwProcessId = procInfo.dwProcessId; - procPtr->nextPtr = procList; - procList = procPtr; + TclWinAddProcess(procInfo.hProcess, procInfo.dwProcessId); } result = TCL_OK; } @@ -1303,11 +1299,7 @@ TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile, *pidPtr = (Tcl_Pid) procInfo.hProcess; if (*pidPtr != 0) { - ProcInfo *procPtr = (ProcInfo *) ckalloc(sizeof(ProcInfo)); - procPtr->hProcess = procInfo.hProcess; - procPtr->dwProcessId = procInfo.dwProcessId; - procPtr->nextPtr = procList; - procList = procPtr; + TclWinAddProcess(procInfo.hProcess, procInfo.dwProcessId); } result = TCL_OK; @@ -2416,6 +2408,36 @@ Tcl_WaitPid(pid, statPtr, options) /* *---------------------------------------------------------------------- * + * TclWinAddProcess -- + * + * Add a process to the process list so that we can use + * Tcl_WaitPid on the process. + * + * Results: + * None + * + * Side effects: + * Adds the specified process handle to the process list so + * Tcl_WaitPid knows about it. + * + *---------------------------------------------------------------------- + */ + +void +TclWinAddProcess(hProcess, id) + HANDLE hProcess; /* Handle to process */ + DWORD id; /* Global process identifier */ +{ + ProcInfo *procPtr = (ProcInfo *) ckalloc(sizeof(ProcInfo)); + procPtr->hProcess = hProcess; + procPtr->dwProcessId = id; + procPtr->nextPtr = procList; + procList = procPtr; +} + +/* + *---------------------------------------------------------------------- + * * Tcl_PidObjCmd -- * * This procedure is invoked to process the "pid" Tcl command. |