[commit: process] master: Make interruptProcessGroupOf interrupt the current process group (#5223) (fdd02c6)
Simon Marlow
marlowsd at gmail.com
Tue Nov 15 13:52:41 CET 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/process
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/fdd02c6464cd73b15195f166377675c9aecf052e
>---------------------------------------------------------------
commit fdd02c6464cd73b15195f166377675c9aecf052e
Author: Simon Marlow <marlowsd at gmail.com>
Date: Mon Nov 14 15:47:21 2011 +0000
Make interruptProcessGroupOf interrupt the current process group (#5223)
>---------------------------------------------------------------
System/Process.hs | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/System/Process.hs b/System/Process.hs
index 0754386..c452b68 100644
--- a/System/Process.hs
+++ b/System/Process.hs
@@ -73,6 +73,9 @@ import System.Process.Internals
import System.IO.Error
#if !defined(mingw32_HOST_OS)
import System.Posix.Types
+#if MIN_VERSION_unix(2,5,0)
+import System.Posix.Process (getProcessGroupIDOf)
+#endif
#endif
import qualified Control.Exception as C
import Control.Concurrent
@@ -568,7 +571,7 @@ terminateProcess ph = do
-- processes created using 'createProcess' and setting the 'create_group' flag
interruptProcessGroupOf
- :: ProcessHandle -- ^ Lead process in the process group
+ :: ProcessHandle -- ^ A process in the process group
-> IO ()
interruptProcessGroupOf ph = do
#if mingw32_HOST_OS
@@ -584,7 +587,13 @@ interruptProcessGroupOf ph = do
case p_ of
ClosedHandle _ -> return p_
OpenHandle h -> do
+#if MIN_VERSION_unix(2,5,0)
+ -- getProcessGroupIDOf was added in unix-2.5.0.0
+ pgid <- getProcessGroupIDOf h
+ signalProcessGroup sigINT pgid
+#else
signalProcessGroup sigINT h
+#endif
return p_
#endif
More information about the Cvs-libraries
mailing list