1 Aug 16:13
runCommand/waitForProcess don't respect text printing order when stdout is redirected
From: Alfonso Acosta <alfonso.acosta <at> gmail.com>
Subject: runCommand/waitForProcess don't respect text printing order when stdout is redirected
Newsgroups: gmane.comp.lang.haskell.libraries
Date: 2008-08-01 14:13:35 GMT
Subject: runCommand/waitForProcess don't respect text printing order when stdout is redirected
Newsgroups: gmane.comp.lang.haskell.libraries
Date: 2008-08-01 14:13:35 GMT
Hi all,
I'm running ghc 6.8.2 in OSX and Linux.
The following program behaves as expected when run on a terminal.
==
module Main where
import System.Process
main = sequence $ replicate 3 command
where command = do putStrLn "foo"
waitForProcess =<< runCommand "echo echo"
putStrLn "bar"
==
$ ghc --make Main.hs -o main
$./main
foo
echo
bar
foo
echo
bar
foo
echo
bar
However, when stdout is redirected to a file, the order is no longer respected:
(Continue reading)
RSS Feed