[commit: packages/process] master: runProcess.c: Don't close already closed pipes (9d68cb1)

git at git.haskell.org git at git.haskell.org
Wed Jul 19 21:17:44 UTC 2017


Repository : ssh://git@git.haskell.org/process

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/9d68cb1bf76d745d1ed9f964f8c6e6397eae4fd6/process

>---------------------------------------------------------------

commit 9d68cb1bf76d745d1ed9f964f8c6e6397eae4fd6
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Mon Dec 12 14:45:40 2016 -0500

    runProcess.c: Don't close already closed pipes
    
    a9a8e914e114913f5eea07da607b29c137bf2041 added some `close` calls which
    attempted to close pipes that we already closed previously. This resulted in the
    error code we read from the failed child being overwritten, resulting in
    the `process004` test failing.


>---------------------------------------------------------------

9d68cb1bf76d745d1ed9f964f8c6e6397eae4fd6
 cbits/runProcess.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cbits/runProcess.c b/cbits/runProcess.c
index fba77a2..d6eae4a 100644
--- a/cbits/runProcess.c
+++ b/cbits/runProcess.c
@@ -341,16 +341,16 @@ runInteractiveProcess (char *const args[],
         waitpid(pid, NULL, 0);
 
         if (fdStdIn == -1) {
-            close(fdStdInput[0]);
+            // Already closed fdStdInput[0] above
             close(fdStdInput[1]);
         }
         if (fdStdOut == -1) {
             close(fdStdOutput[0]);
-            close(fdStdOutput[1]);
+            // Already closed fdStdOutput[1] above
         }
         if (fdStdErr == -1) {
             close(fdStdError[0]);
-            close(fdStdError[1]);
+            // Already closed fdStdError[1] above
         }
 
         pid = -1;



More information about the ghc-commits mailing list