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.

This commit is contained in:
Brad King 2005-12-31 12:59:31 -05:00
parent ccae106177
commit 8489a94101

View File

@ -1187,11 +1187,17 @@ static void kwsysProcessCleanup(kwsysProcess* cp, int error)
/* Kill any children already started. */
if(cp->ForkPIDs)
{
int status;
for(i=0; i < cp->NumberOfCommands; ++i)
{
if(cp->ForkPIDs[i])
{
/* Kill the child. */
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));
}
}
}