[commit: packages/process] master: Make `cleanupProcess` resistant to SIGPIPE (776a260)

git at git.haskell.org git at git.haskell.org
Tue Dec 3 10:26:42 UTC 2013


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/776a260be009cc27cfeacf298934d544c4e87408/process

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

commit 776a260be009cc27cfeacf298934d544c4e87408
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sun Dec 1 11:15:44 2013 +0100

    Make `cleanupProcess` resistant to SIGPIPE
    
    Otherwise, `cleanupProcess` may exit prematurely if trying to flush out
    data to the process' stdin handle even though the endpoint has already
    vanished, and fail to complete the cleanup process.
    
    See also 228297ec53e9ee7a1a6a3c5964ca7e89a6474c9b and #2233.
    
    Signed-off-by: Herbert Valerio Riedel <hvr at gnu.org>


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

776a260be009cc27cfeacf298934d544c4e87408
 System/Process.hs |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/System/Process.hs b/System/Process.hs
index f8b0b7f..7f76666 100644
--- a/System/Process.hs
+++ b/System/Process.hs
@@ -259,7 +259,7 @@ cleanupProcess (mb_stdin, mb_stdout, mb_stderr, ph) = do
     -- Note, it's important that other threads that might be reading/writing
     -- these handles also get killed off, since otherwise they might be holding
     -- the handle lock and prevent us from closing, leading to deadlock.
-    maybe (return ()) hClose mb_stdin
+    maybe (return ()) (ignoreSigPipe . hClose) mb_stdin
     maybe (return ()) hClose mb_stdout
     maybe (return ()) hClose mb_stderr
     -- terminateProcess does not guarantee that it terminates the process.



More information about the ghc-commits mailing list