BUG: Do not close stdout/stderr pipes in parent if they are shared.

This commit is contained in:
Brad King 2005-04-21 16:05:09 -04:00
parent 3f224b7558
commit 8567e7d0bc
2 changed files with 13 additions and 4 deletions

View File

@ -689,7 +689,10 @@ void kwsysProcess_Execute(kwsysProcess* cp)
} }
/* The parent process does not need the output pipe write ends. */ /* The parent process does not need the output pipe write ends. */
kwsysProcessCleanupDescriptor(&si.StdErr); if(si.StdErr != 2)
{
kwsysProcessCleanupDescriptor(&si.StdErr);
}
kwsysProcessCleanupDescriptor(&si.TermPipe); kwsysProcessCleanupDescriptor(&si.TermPipe);
/* Restore the working directory. */ /* Restore the working directory. */
@ -1395,7 +1398,10 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
} }
/* The parent process does not need the output pipe write ends. */ /* The parent process does not need the output pipe write ends. */
kwsysProcessCleanupDescriptor(&si->StdOut); if(si->StdOut != 1)
{
kwsysProcessCleanupDescriptor(&si->StdOut);
}
return 1; return 1;
} }

View File

@ -1160,7 +1160,7 @@ void kwsysProcess_Execute(kwsysProcess* cp)
{ {
kwsysProcessCleanupHandle(&si.StartupInfo.hStdOutput); kwsysProcessCleanupHandle(&si.StartupInfo.hStdOutput);
} }
if(si.StartupInfo.hStdOutput != GetStdHandle(STD_ERROR_HANDLE)) if(si.StartupInfo.hStdError != GetStdHandle(STD_ERROR_HANDLE))
{ {
kwsysProcessCleanupHandle(&si.StartupInfo.hStdError); kwsysProcessCleanupHandle(&si.StartupInfo.hStdError);
} }
@ -1176,7 +1176,10 @@ void kwsysProcess_Execute(kwsysProcess* cp)
/* Close the inherited handles to the stderr pipe shared by all /* Close the inherited handles to the stderr pipe shared by all
processes in the pipeline. */ processes in the pipeline. */
kwsysProcessCleanupHandle(&si.StartupInfo.hStdError); if(si.StartupInfo.hStdError != GetStdHandle(STD_ERROR_HANDLE))
{
kwsysProcessCleanupHandle(&si.StartupInfo.hStdError);
}
/* Restore the working directory. */ /* Restore the working directory. */
if(cp->RealWorkingDirectory) if(cp->RealWorkingDirectory)