Hello
Using system or any variant of it from System.Process
seems broken in multithreaded environments. This
example will fail with and without -threaded.
When run the program will print hello: start and
then freeze. After pressing enter (the first getChar)
System.Cmd.system will complete, but
Here is a version that works fine:
myRawSystem cmd args = do
(inP, outP, errP, pid) - runInteractiveProcess cmd args Nothing Nothing
hClose inP
os - pGetContents outP
es - pGetContents errP
ec - waitForProcess pid
case ec of
ExitSuccess - return ()