summaryrefslogtreecommitdiff
path: root/src/Utility
diff options
context:
space:
mode:
authorJoey Hess2015-10-28 11:09:53 -0400
committerJoey Hess2015-10-28 11:09:53 -0400
commit9b27331f216bc23ca8b548800652641e4b59e2a8 (patch)
treebd5ebb34bc9d7ecde6a2c89715389770ee2e104b /src/Utility
parent4e84fa68e3ea2a11e85d09860f2d6440d91e27d1 (diff)
improve comment
Diffstat (limited to 'src/Utility')
-rw-r--r--src/Utility/ConcurrentOutput.hs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Utility/ConcurrentOutput.hs b/src/Utility/ConcurrentOutput.hs
index 186f881f..3624ffbf 100644
--- a/src/Utility/ConcurrentOutput.hs
+++ b/src/Utility/ConcurrentOutput.hs
@@ -117,12 +117,17 @@ updateOutputLocker l = do
-- multiple processes that are running concurrently from writing
-- to stdout/stderr at the same time.
--
--- The first process is allowed to write to stdout and stderr in the usual way.
+-- If the process does not output to stdout or stderr, it's run
+-- by createProcess entirely as usual. Only processes that can generate
+-- output are handled specially:
--
--- However, if another process is run concurrently with the
--- first, any stdout or stderr that would have been displayed by it is
--- instead buffered. The buffered output will be displayed the next time it
--- is safe to do so (ie, after the first process exits).
+-- A process is allowed to write to stdout and stderr in the usual
+-- way, assuming it can successfully take the output lock.
+--
+-- When the output lock is held (by another process or other caller of
+-- `lockOutput`), the process is instead run with its stdout and stderr
+-- redirected to a buffer. The buffered output will be displayed as soon
+-- as the output lock becomes free.
createProcessConcurrent :: P.CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, P.ProcessHandle)
createProcessConcurrent p
| hasoutput (P.std_out p) || hasoutput (P.std_err p) =