Browse Source

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

Brad King 21 years ago
parent
commit
55c1c3b33f
1 changed files with 6 additions and 1 deletions
  1. 6 1
      Source/kwsys/ProcessUNIX.c

+ 6 - 1
Source/kwsys/ProcessUNIX.c

@@ -711,7 +711,8 @@ kwsysEXPORT void kwsysProcess_Disown(kwsysProcess* cp)
   int i;
   int i;
 
 
   /* Make sure a detached child process is running.  */
   /* 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;
     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;
   cp->State = kwsysProcess_State_Disowned;
 }
 }