Commit 8489a941 authored by Brad King's avatar Brad King
Browse files

BUG: When more than one command is given and one of them fails to start and...

BUG: When more than one command is given and one of them fails to start and the rest are killed, do not forget to reap the killed children.
parent ccae1061
...@@ -1187,11 +1187,17 @@ static void kwsysProcessCleanup(kwsysProcess* cp, int error) ...@@ -1187,11 +1187,17 @@ static void kwsysProcessCleanup(kwsysProcess* cp, int error)
/* Kill any children already started. */ /* Kill any children already started. */
if(cp->ForkPIDs) if(cp->ForkPIDs)
{ {
int status;
for(i=0; i < cp->NumberOfCommands; ++i) for(i=0; i < cp->NumberOfCommands; ++i)
{ {
if(cp->ForkPIDs[i]) if(cp->ForkPIDs[i])
{ {
/* Kill the child. */
kwsysProcessKill(cp->ForkPIDs[i]); kwsysProcessKill(cp->ForkPIDs[i]);
/* Reap the child. Keep trying until the call is not
interrupted. */
while((waitpid(cp->ForkPIDs[i], &status, 0) < 0) &&
(errno == EINTR));
} }
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment