path: root/src/System/Process
diff options
authorJoey Hess2020-08-14 15:55:28 -0400
committerJoey Hess2020-08-14 15:55:28 -0400
commit9c08fa24f2e2bf07413b151656c373d873de7298 (patch)
treeb53b9fe2585ab60536640fd6a4dcbc798c355742 /src/System/Process
parent5eab7dbb71faf7c5a31daf141a26d8207c919e89 (diff)
Revert "merge from concurrent-output"
This reverts commit 162e1d4e82e24f0fe3e2bd3114e4366ddb1062c0. concurrent-output depends on process-1.6.0. Older versions of process have a bug that it tickles. But, propellor does not depend on this version of process.
Diffstat (limited to 'src/System/Process')
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