ecere/sys/DualPipe: (UNIX) Calling waitpid() in destructor
authorJerome St-Louis <jerome@ecere.com>
Sat, 22 Oct 2016 14:07:24 +0000 (10:07 -0400)
committerJerome St-Louis <jerome@ecere.com>
Sat, 22 Oct 2016 15:13:26 +0000 (11:13 -0400)
- Also calling fclose() on handles

ecere/src/sys/DualPipe.c

index c9eba7c..62e6bff 100644 (file)
@@ -63,17 +63,17 @@ void DualPipe_Destructor(_DualPipe * dp)
 {
 #if defined(__WIN32__)
    if(dp->outputHandle)
-   {
       CloseHandle(dp->outputHandle);
-      dp->outputHandle = null;
-   }
    if(dp->inputHandle)
-   {
       CloseHandle(dp->inputHandle);
-      dp->inputHandle = null;
-   }
    if(dp->hProcess)
       CloseHandle(dp->hProcess);
+#else
+   if(!dp->gotExitCode)
+   {
+      int status = 0;
+      waitpid(dp->pid, &status, WNOHANG);
+   }
 #endif
    free(dp);
 }