process: Confusion about UseHandle handles being closed.

Michael Snoyman michael at snoyman.com
Tue Nov 25 10:27:19 UTC 2014


I originally opened this as a Github issue[1] about this, but due to lack
of attention, Herbert recommended that I send it to the libraries list as
well. Here's the issue description copied verbatim from Github:

When working on a library, I was surprised to find that the `Handle`s that
I passed in for `std_in`, `std_out` and `std_err` via `UseHandle` were
automatically closed. This is not clear from the documentation, and- at
least for the use case I was interested in- the opposite of what I needed.
There are valid cases where we'd want the `Handle` to remain open after the
process runs to completion.

The function `createProcess_` in the `.Internals` module has the behavior I
was looking for, and for my purpose, I can simply import from there. I'd
like to propose two changes:

1. Add clear documentation to `createProcess` indicating that it will close
the `Handle` automatically.
2. Add a new function to be exported from `System.Process` with the
semantics of `createProcess_`. I'm open to bikeshedding on the name, but
perhaps sticking with `createProcess_` makes the most sense.

Note that I do *not* think we should change the existing semantics of
`createProcess`: I think it's a large breaking change, and should be
avoided.

I'm happy to provide pull requests for both of these, I just wanted to
check if there was objection before going ahead with it.

Michael

[1] https://github.com/haskell/process/issues/2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141125/b50e998c/attachment.html>


More information about the Libraries mailing list