[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Coprocess terminated, pipe closed before I read the data out
From: |
Chet Ramey |
Subject: |
Re: Coprocess terminated, pipe closed before I read the data out |
Date: |
Thu, 14 Apr 2016 13:33:38 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 |
On 4/13/16 1:13 AM, George wrote:
> Users can work around this by duplicating the file descriptor:
> $ exec {fd_that_wont_vanish_on_me}<&${coproc[0]}-
> But it kind of negates the benefit of having coproc accept a name for
> the fd array if you just wind up having to re-bind it anyway. And the
> command could still fail if it's not run immediately after launching
> the coproc.
>
> Thus, I think coproc shouldn't close its file descriptors or erase its
> environment variables.
This an interesting suggestion. I will look at it for a future version.
You have to be careful with writing to a pipe where the reader has gone
away, though, since that will generate SIGPIPE.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/