Open
Description
Both the Process docs and the Process.start docs claim that when the process finishes the handles will be closed, but that does not seem to be the case:
main = do
(stdin, stdout, stderr, p) = start "echo" ["hello", "world"]
exitCode = wait p
Debug.trace "stdin is open?" (isOpen stdin)
Debug.trace "stdout is open?" (isOpen stdout)
Debug.trace "stderr is open?" (isOpen stderr)
Handle.close stdin
Debug.trace "stdin is open now?" (isOpen stdin)
Handle.close stdout
Debug.trace "stdout is open now?" (isOpen stdout)
Handle.close stderr
Debug.trace "stderr is open now?" (isOpen stderr)
> run main
trace: stdin is open?
true
trace: stdout is open?
true
trace: stderr is open?
true
trace: stdin is open now?
false
trace: stdout is open now?
false
trace: stderr is open now?
false
I think that the correct solution to this is to change the docs. You don't necessarily want the handles (or at least the stdout and stderr) handles to be closed immediately, because the caller might not be finished consuming them yet.
Metadata
Assignees
Labels
No labels