Browse Source

BUG: When killing a child all the pipe read ends should be closed. This will allow a child that is blocking while waiting to write to the pipe to wake up and receive the kill signal properly on cygwin.

Brad King 20 years ago
parent
commit
c98bd6249a
1 changed files with 7 additions and 2 deletions
  1. 7 2
      Source/kwsys/ProcessUNIX.c

+ 7 - 2
Source/kwsys/ProcessUNIX.c

@@ -905,7 +905,6 @@ int kwsysProcess_WaitForData(kwsysProcess* cp, char** data, int* length,
       kwsysProcess_Kill(cp);
       cp->Killed = 0;
       cp->SelectError = 1;
-      cp->PipesLeft = 0;
       }
     }
 
@@ -943,7 +942,6 @@ int kwsysProcess_WaitForData(kwsysProcess* cp, char** data, int* length,
       kwsysProcess_Kill(cp);
       cp->Killed = 0;
       cp->TimeoutExpired = 1;
-      cp->PipesLeft = 0;
       return kwsysProcess_Pipe_None;
       }
     }
@@ -1076,6 +1074,13 @@ void kwsysProcess_Kill(kwsysProcess* cp)
       kwsysProcessKill(cp->ForkPIDs[i]);
       }
     }
+
+  /* Close all the pipe read ends.  */
+  for(i=0; i < KWSYSPE_PIPE_COUNT; ++i)
+    {
+    kwsysProcessCleanupDescriptor(&cp->PipeReadEnds[i]);
+    }
+  cp->PipesLeft = 0;
 }
 
 /*--------------------------------------------------------------------------*/