|author||Joey Hess||2018-04-30 09:16:05 -0400|
|committer||Joey Hess||2018-04-30 09:16:05 -0400|
Revert "Added dependency on concurrent-output; removed embedded copy."
This reverts commit 02eca2ae4cf51d8e83d94d8359e15ac053451109. This seems to have broken propellor badly, in testing I'm seeing it crash at the end of a run with "thread blocked indefinitely in an STM transaction" and also during the run it printed out some odd output like: apache2: apache2: dummy IN SSHFP 4 1 35df80973f5877e4041f1b70947385eb2f6a0822 dummy IN SSHFP 4 2 3a0bb426e76eebc5c56e3b0f1428aa9d18539e9621bf8f9e3b7f56a4e7d81c85 Which seems like it might be output of commands that propellor is supposed to be reading? Seems likely that there's a bug or two that have crept into then concurrent-output library since the version embedded in propellor.
Diffstat (limited to 'src/System/Process')
1 files changed, 34 insertions, 0 deletions
diff --git a/src/System/Process/Concurrent.hs b/src/System/Process/Concurrent.hs
new file mode 100644
@@ -0,0 +1,34 @@
+-- Copyright: 2015 Joey Hess <firstname.lastname@example.org>
+-- License: BSD-2-clause
+-- The functions exported by this module are intended to be drop-in
+-- replacements for those from System.Process, when converting a whole
+-- program to use System.Console.Concurrent.
+module System.Process.Concurrent where
+import System.Console.Concurrent.Internal (ConcurrentProcessHandle(..))
+import System.Process hiding (createProcess, waitForProcess)
+-- | 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 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 . ConcurrentProcessHandle