process: Confusion about UseHandle handles being closed.

Michael Snoyman michael at snoyman.com
Tue Nov 25 14:22:25 UTC 2014


On Tue Nov 25 2014 at 3:20:27 PM Brandon Allbery <allbery.b at gmail.com>
wrote:

> On Tue, Nov 25, 2014 at 5:27 AM, Michael Snoyman <michael at snoyman.com>
> wrote:
>
>> 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.
>
>
> Can you explain that use case? It's usually an error to try to use the
> file descriptor in the parent as well as the child, because there's no way
> to prevent interleaved I/O at the OS level.
>
>
>
I don't remember the exact situation I was in when I wrote that issue, but
one situation would be opening a log file in the parent process and then
running multiple child processes sequentially, redirecting all of their
output to the same Handle. There is always one process acting on the file
descriptor, so interleaving isn't a problem.

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141125/5218b3de/attachment.html>


More information about the Libraries mailing list