[commit: packages/process] master: GH77: Add appropriate ifdefs. (4a423ad)

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


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/4a423ad28582d7e0a68b184f6c5eed8a25fa29ef/process

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

commit 4a423ad28582d7e0a68b184f6c5eed8a25fa29ef
Author: Tamar Christina <tamar at zhox.com>
Date:   Sun Jan 8 11:29:18 2017 +0000

    GH77: Add appropriate ifdefs.


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

4a423ad28582d7e0a68b184f6c5eed8a25fa29ef
 System/Process.hs | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/System/Process.hs b/System/Process.hs
index 245ad8b..a0574e4 100644
--- a/System/Process.hs
+++ b/System/Process.hs
@@ -609,10 +609,13 @@ waitForProcess ph@(ProcessHandle _ delegating_ctlc) = do
           endDelegateControlC e
         return e
     OpenExtHandle _ job iocp -> do
-        maybe (ExitFailure (-1)) mkExitCode <$> waitForJobCompletion job iocp timeout_Infinite
+#if defined(WINDOWS)
+        maybe (ExitFailure (-1)) mkExitCode `fmap` waitForJobCompletion job iocp timeout_Infinite
       where mkExitCode code | code == 0 = ExitSuccess
                             | otherwise = ExitFailure $ fromIntegral code
-
+#else
+        error "OpenExtHandle should not happen on POSIX."
+#endif
 
 -- ----------------------------------------------------------------------------
 -- getProcessExitCode
@@ -677,7 +680,11 @@ terminateProcess ph = do
   withProcessHandle ph $ \p_ ->
     case p_ of
       ClosedHandle  _ -> return ()
+#if defined(WINDOWS)
       OpenExtHandle{} -> terminateJob ph 1 >> return ()
+#else
+      OpenExtHandle{} -> error "terminateProcess with OpenExtHandle should not happen on POSIX."
+#endif
       OpenHandle    h -> do
         throwErrnoIfMinus1Retry_ "terminateProcess" $ c_terminateProcess h
         return ()



More information about the ghc-commits mailing list