Skip to content
Snippets Groups Projects
Commit c65dfa03 authored by Brad King's avatar Brad King
Browse files

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

parent c8eef02b
No related branches found
No related tags found
No related merge requests found
......@@ -689,7 +689,10 @@ void kwsysProcess_Execute(kwsysProcess* cp)
}
/* The parent process does not need the output pipe write ends. */
kwsysProcessCleanupDescriptor(&si.StdErr);
if(si.StdErr != 2)
{
kwsysProcessCleanupDescriptor(&si.StdErr);
}
kwsysProcessCleanupDescriptor(&si.TermPipe);
/* 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. */
kwsysProcessCleanupDescriptor(&si->StdOut);
if(si->StdOut != 1)
{
kwsysProcessCleanupDescriptor(&si->StdOut);
}
return 1;
}
......
......@@ -1160,7 +1160,7 @@ void kwsysProcess_Execute(kwsysProcess* cp)
{
kwsysProcessCleanupHandle(&si.StartupInfo.hStdOutput);
}
if(si.StartupInfo.hStdOutput != GetStdHandle(STD_ERROR_HANDLE))
if(si.StartupInfo.hStdError != GetStdHandle(STD_ERROR_HANDLE))
{
kwsysProcessCleanupHandle(&si.StartupInfo.hStdError);
}
......@@ -1176,7 +1176,10 @@ void kwsysProcess_Execute(kwsysProcess* cp)
/* Close the inherited handles to the stderr pipe shared by all
processes in the pipeline. */
kwsysProcessCleanupHandle(&si.StartupInfo.hStdError);
if(si.StartupInfo.hStdError != GetStdHandle(STD_ERROR_HANDLE))
{
kwsysProcessCleanupHandle(&si.StartupInfo.hStdError);
}
/* Restore the working directory. */
if(cp->RealWorkingDirectory)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment