[commit: packages/process] master: fix build. (9bcbaeb)

git at git.haskell.org git at git.haskell.org
Wed Jul 19 21:18:57 UTC 2017


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

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

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

commit 9bcbaeb7bd53d10087ebedd53b1d87efac814aac
Author: Tamar Christina <tamar at zhox.com>
Date:   Sun Jan 29 21:48:24 2017 +0000

    fix build.


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

9bcbaeb7bd53d10087ebedd53b1d87efac814aac
 System/Process.hs | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/System/Process.hs b/System/Process.hs
index 53c1f21..81a5788 100644
--- a/System/Process.hs
+++ b/System/Process.hs
@@ -636,17 +636,19 @@ getProcessExitCode ph@(ProcessHandle _ delegating_ctlc) = do
       ClosedHandle e -> return (p_, (Just e, False))
       open -> do
         alloca $ \pExitCode -> do
-            res <- let getCode h = throwErrnoIfMinus1Retry "getProcessExitCode" $
-                                       c_getProcessExitCode h pExitCode
-                   in maybe (return 0) getCode $ getHandle open
-            if res == 0
-              then return (p_, (Nothing, False))
-              else do
-                   code <- peek pExitCode
-                   closePHANDLE h
-                   let e  | code == 0 = ExitSuccess
-                          | otherwise = ExitFailure (fromIntegral code)
-                   return (ClosedHandle e, (Just e, True))
+          case getHandle open of
+            Nothing -> return (p_, (Nothing, False))
+            Just h  -> do
+                res <- throwErrnoIfMinus1Retry "getProcessExitCode" $
+                                        c_getProcessExitCode h pExitCode
+                code <- peek pExitCode
+                if res == 0
+                   then return (p_, (Nothing, False))
+                   else do
+                        closePHANDLE h
+                        let e  | code == 0 = ExitSuccess
+                               | otherwise = ExitFailure (fromIntegral code)
+                        return (ClosedHandle e, (Just e, True))
   case m_e of
     Just e | was_open && delegating_ctlc -> endDelegateControlC e
     _                                    -> return ()



More information about the ghc-commits mailing list