-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify behaviour of close_fds
on Windows
#235
Comments
@Mistuke do you have any thoughts here? |
The answer to this is.. it depends. So one clarification specifically, when
This is again, it depends. Point of clarification, What can be inherited on Windows are Now GHC on Windows has two I/O managers, and the behavior depends on the I/O manager: So for: (rstdin, wstdin) <- createPipe
(_,_,_,p) <- createProcess (proc "cat" []) { std_in = UseHandle rstdin, close_fds = True }
hPutStr wstdin "foo"
hClose wstdin
waitProcess p
No, this wouldn't hang.
Yes, this would hang because However most WinIO relies on being able to share all The situation is not ideal... I think it would be better if |
Thank you for the detailed explanation. I see how that is hard to document clearly :/ I like the general idea of providing an API where (I've solved my particular problem that prompted this issue by reverting to use |
The documentation of
close_fds
states that:It's quite unclear what "only works" means. Will things blow up if I set
close_fds
andCreatePipe
? My best guess is something like "if any ofstd_in
,std_out
,std_err
are 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
.)The text was updated successfully, but these errors were encountered: