Commit 776a260b authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺
Browse files

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 228297ec

 and #2233.
Signed-off-by: Herbert Valerio Riedel's avatarHerbert Valerio Riedel <>
parent 228297ec
......@@ -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.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment