BUG: Do not disown if process has already been killed or the timeout expired. Also need to call kwsysProcessCleanup to disown.

This commit is contained in:
Brad King 2004-07-07 17:46:34 -04:00
parent ae28d93a72
commit 55c1c3b33f
1 changed files with 6 additions and 1 deletions

View File

@ -711,7 +711,8 @@ kwsysEXPORT void kwsysProcess_Disown(kwsysProcess* cp)
int i;
/* Make sure a detached child process is running. */
if(!cp || !cp->Detached || cp->State != kwsysProcess_State_Executing)
if(!cp || !cp->Detached || cp->State != kwsysProcess_State_Executing ||
cp->TimeoutExpired || cp->Killed)
{
return;
}
@ -740,6 +741,10 @@ kwsysEXPORT void kwsysProcess_Disown(kwsysProcess* cp)
}
}
/* We will not wait for exit, so cleanup now. */
kwsysProcessCleanup(cp, 0);
/* The process has been disowned. */
cp->State = kwsysProcess_State_Disowned;
}