summaryrefslogtreecommitdiff
path: root/src/System/Process
diff options
context:
space:
mode:
Diffstat (limited to 'src/System/Process')
-rw-r--r--src/System/Process/Concurrent.hs16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/System/Process/Concurrent.hs b/src/System/Process/Concurrent.hs
index 346ce2e0..0e00e4fd 100644
--- a/src/System/Process/Concurrent.hs
+++ b/src/System/Process/Concurrent.hs
@@ -9,14 +9,26 @@
module System.Process.Concurrent where
import System.Console.Concurrent
+import System.Console.Concurrent.Internal (ConcurrentProcessHandle(..))
import System.Process hiding (createProcess, waitForProcess)
import System.IO
import System.Exit
-- | Calls `createProcessConcurrent`
+--
+-- You should use the waitForProcess in this module on the resulting
+-- ProcessHandle. Using System.Process.waitForProcess instead can have
+-- mildly unexpected results.
createProcess :: CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
-createProcess = createProcessConcurrent
+createProcess p = do
+ (i, o, e, ConcurrentProcessHandle h) <- createProcessConcurrent p
+ return (i, o, e, h)
-- | Calls `waitForProcessConcurrent`
+--
+-- You should only use this on a ProcessHandle obtained by calling
+-- createProcess from this module. Using this with a ProcessHandle
+-- obtained from System.Process.createProcess etc will have extremely
+-- unexpected results; it can wait a very long time before returning.
waitForProcess :: ProcessHandle -> IO ExitCode
-waitForProcess = waitForProcessConcurrent
+waitForProcess = waitForProcessConcurrent . ConcurrentProcessHandle