process: Confusion about UseHandle handles being closed.

Michael Snoyman michael at snoyman.com
Wed Nov 26 08:39:27 UTC 2014


On Tue Nov 25 2014 at 12:27:26 PM Michael Snoyman <michael at snoyman.com>
wrote:

> 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
>

Since it seems that there's no objection to exposing createProcess_ as a
short term solution, I've put together a pull request[1]. The only code
change is exposing createProcess_; all other changes are documentation.

Michael

[1] https://github.com/haskell/process/pull/12
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141126/47329df5/attachment.html>


More information about the Libraries mailing list