Open
Description
The following Haskell program, built with GHC 8.0.1, deadlocks on Windows Server 2012:
import System.Process
import System.IO
import System.Exit
main = do
hSetBuffering stderr NoBuffering
hSetBuffering stdout NoBuffering
(readIn, writeIn) <- createPipe
(readOut, writeOut) <- createPipe
(_,_,_,proch) <- createProcess (proc "python" ["-i"]) {
std_in = UseHandle readIn,
std_out = UseHandle writeOut,
std_err = UseHandle writeOut
}
hPutStrLn writeIn "print(42)"
hPutStrLn writeIn "quit()"
hClose writeIn
exit <- waitForProcess proch
hPutStrLn stderr =<< hGetContents readOut
hClose readOut
exitWith exit
You can reproduce the error on AppVeyor with the following repository: https://github.com/ezyang/ghceye (appveyor.yml included).
It does not appear to deadlock on Windows 10 or Linux. I have not attempted to reproduce on a local install of Windows Server 2012. I tried this similar Python code which did not deadlock, which is why I believe it to be a bug in the process library:
import subprocess
import os
(rin, win) = os.pipe()
(rout, wout) = os.pipe()
p = subprocess.Popen(["python", "-i"], stdin=rin, stdout=wout, stderr=wout)
os.write(win, "print(2)")
os.write(win, os.linesep)
os.write(win, "quit()")
os.write(win, os.linesep)
p.wait()
Metadata
Metadata
Assignees
Labels
No labels