[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bash-bug
Subject:    Re: Coprocess terminated, pipe closed before I read the data out
From:       Chet Ramey <chet.ramey () case ! edu>
Date:       2016-04-14 17:33:38
Message-ID: 570FD472.30506 () case ! edu
[Download RAW message or body]

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/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic