Fix dangling pipe: we didn't close the child's ends of
the pipes in the parent, so it kept a reference to the handles. (This didn't cause problems normally, but since the child's ends of the pipes remained open when it closed, it reduced reliability in failure cases.)
This commit is contained in:
@@ -122,7 +122,7 @@ bool StartChild( HANDLE &hProcess, HANDLE &hToStdin, HANDLE &hFromStdout )
|
||||
strcat( szBuf, CHILD_MAGIC_PARAMETER );
|
||||
|
||||
PROCESS_INFORMATION pi;
|
||||
if( !CreateProcess(
|
||||
int iRet = CreateProcess(
|
||||
NULL, // pointer to name of executable module
|
||||
szBuf, // pointer to command line string
|
||||
NULL, // process security attributes
|
||||
@@ -133,8 +133,17 @@ bool StartChild( HANDLE &hProcess, HANDLE &hToStdin, HANDLE &hFromStdout )
|
||||
cwd, // pointer to current directory name
|
||||
&si, // pointer to STARTUPINFO
|
||||
&pi // pointer to PROCESS_INFORMATION
|
||||
) )
|
||||
);
|
||||
|
||||
CloseHandle( si.hStdInput );
|
||||
CloseHandle( si.hStdOutput );
|
||||
|
||||
if( !iRet )
|
||||
{
|
||||
CloseHandle( hToStdin );
|
||||
CloseHandle( hFromStdout );
|
||||
return false;
|
||||
}
|
||||
|
||||
hProcess = pi.hProcess;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user