The documentation of close_fds states that:
Close all file descriptors except stdin, stdout and stderr in the new process (on Windows, only works if std_in, std_out, and std_err are all Inherit).
It's quite unclear what "only works" means. Will things blow up if I set close_fds and CreatePipe? My best guess is something like "if any of std_in, std_out, std_err are not Inherit, those will be closed too".
Specifically, based on the documentation, I can't answer the question whether
(rstdin, wstdin) <- createPipe
(_,_,_,p) <- createProcess (proc "cat" []) { std_in = UseHandle rstdin, close_fds = True }
hPutStr wstdin "foo"
hClose wstdin
waitProcess p
should work on Windows. (This hangs on Linux without close_fds, (apparently) because the child inherits the open write-end, causing the pipe to stay open despite hClose.)
The documentation of
close_fdsstates that:It's quite unclear what "only works" means. Will things blow up if I set
close_fdsandCreatePipe? My best guess is something like "if any ofstd_in,std_out,std_errare notInherit, those will be closed too".Specifically, based on the documentation, I can't answer the question whether
should work on Windows. (This hangs on Linux without
close_fds, (apparently) because the child inherits the open write-end, causing the pipe to stay open despitehClose.)