Skip to content

Process docs make false claim about closing handles #177

Open
@ceedubs

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions