[commit: packages/process] master: Merge pull request #58 from charles-cooper/master (3d32c5c)

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


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/3d32c5cd9e986fcb6db80d2503e3006c2a33479c/process

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

commit 3d32c5cd9e986fcb6db80d2503e3006c2a33479c
Merge: e9a201b 48c8fde
Author: Michael Snoyman <michael at snoyman.com>
Date:   Tue Feb 21 15:52:18 2017 +0200

    Merge pull request #58 from charles-cooper/master
    
    Fix #46



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

3d32c5cd9e986fcb6db80d2503e3006c2a33479c
 System/Process.hs          | 38 ++++++++++++++++++++++++++++++--------
 System/Process/Common.hs   | 10 +++++++---
 System/Process/Posix.hs    |  3 ++-
 System/Process/Windows.hsc |  3 ++-
 process.cabal              |  2 ++
 test/main.hs               | 17 ++++++++++++++++-
 6 files changed, 59 insertions(+), 14 deletions(-)

diff --cc System/Process.hs
index 0112659,bc4c1ae..8842daa
--- a/System/Process.hs
+++ b/System/Process.hs
@@@ -614,9 -612,15 +612,16 @@@ waitForProcess ph@(ProcessHandle _ dele
        where mkExitCode code | code == 0 = ExitSuccess
                              | otherwise = ExitFailure $ fromIntegral code
  #else
 +    OpenExtHandle _ _job _iocp ->
          return $ ExitFailure (-1)
  #endif
+   where
+     -- If more than one thread calls `waitpid` at a time, `waitpid` will
+     -- return the exit code to one of them and (-1) to the rest of them,
+     -- causing an exception to be thrown.
+     -- Cf. https://github.com/haskell/process/issues/46, and
+     -- https://github.com/haskell/process/pull/58 for further discussion
+     lockWaitpid m = withMVar (waitpidLock ph) $ \() -> m
  
  -- ----------------------------------------------------------------------------
  -- getProcessExitCode



More information about the ghc-commits mailing list