[commit: process] master: Win32 fixes : process.cabal and test 3994 (win32 process must be started before it can be interrupted) (192b791)

Simon Marlow marlowsd at gmail.com
Wed May 11 11:12:31 CEST 2011


Repository : ssh://darcs.haskell.org//srv/darcs/packages/process

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/192b791dea93e8727713ab33a397aab4e7ffdc71

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

commit 192b791dea93e8727713ab33a397aab4e7ffdc71
Author: Hamish Mackenzie <Hamish.K.Mackenzie at googlemail.com>
Date:   Sun Apr 24 03:47:25 2011 +1200

    Win32 fixes : process.cabal and test 3994 (win32 process must be started before it can be interrupted)

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

 process.cabal     |    5 ++++-
 tests/3994.hs     |    7 +++++--
 tests/3994.stdout |    1 +
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/process.cabal b/process.cabal
index cd62bbe..ad3d1d9 100644
--- a/process.cabal
+++ b/process.cabal
@@ -39,7 +39,10 @@ Library {
     install-includes:
         runProcess.h
         HsProcessConfig.h
-    if !os(windows)
+    if os(windows)
+        build-depends: Win32 >=2.2.0.0
+        extra-libraries: kernel32
+    else
         build-depends: unix
   }
 
diff --git a/tests/3994.hs b/tests/3994.hs
index 5bb16b3..15ea88e 100644
--- a/tests/3994.hs
+++ b/tests/3994.hs
@@ -5,15 +5,18 @@ import System.IO
 import System.Process
 
 main :: IO ()
-main = do (_,_,_,p) <- createProcess (proc "sleep" ["10"])
+main = do (_,Just hout,_,p) <- createProcess (proc "sh" ["-c", "echo start; sleep 10"])
                             { std_out = CreatePipe, create_group = True }
+          start <- hGetLine hout
+          putStrLn start
           interruptProcessGroupOf p
           t <- myThreadId
                -- timeout
           forkIO $ do
             threadDelay 5000000
+            putStrLn "Interrupting a Running Process Failed"
+            hFlush stdout
             killThread t
           waitForProcess p
           putStrLn "end"
           return ()
-
diff --git a/tests/3994.stdout b/tests/3994.stdout
index a6a9baf..5d0fb3b 100644
--- a/tests/3994.stdout
+++ b/tests/3994.stdout
@@ -1 +1,2 @@
+start
 end





More information about the Cvs-libraries mailing list