From ec093725eb39a9fc8929d9ee684bdc62914f1995 Mon Sep 17 00:00:00 2001 From: Mikhail Glushenkov Date: Fri, 25 Oct 2013 16:49:22 +0200 Subject: [PATCH] 'syncProcess': don't restore handlers before the child finished. Fixes #1560. --- Cabal/Distribution/Simple/Utils.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cabal/Distribution/Simple/Utils.hs b/Cabal/Distribution/Simple/Utils.hs index 9a5fe3d719c..54caa39a2ae 100644 --- a/Cabal/Distribution/Simple/Utils.hs +++ b/Cabal/Distribution/Simple/Utils.hs @@ -408,10 +408,10 @@ syncProcess fun c = do -- in the child (using SIG_DFL isn't really correct, it should be the -- original signal handler, but the GHC RTS will have already set up -- its own handler and we don't want to use that). - (_,_,_,p) <- Exception.bracket (installHandlers) (restoreHandlers) $ - (\_ -> runGenProcess_ fun c - (Just defaultSignal) (Just defaultSignal)) - r <- waitForProcess p + r <- Exception.bracket (installHandlers) (restoreHandlers) $ + (\_ -> do (_,_,_,p) <- runGenProcess_ fun c + (Just defaultSignal) (Just defaultSignal) + waitForProcess p) return r where installHandlers = do