From: Jeff King Date: Fri, 27 Apr 2012 07:59:53 GMT Subject: Re: [PATCH] t5570: fix forwarding of git-daemon messages via cat Message-ID: <20120427075953.GB12092@sigill.intra.peff.net> In-Reply-To: <4F99B777.4020103@kdbg.org> On Thu, Apr 26, 2012 at 11:00:39PM +0200, Johannes Sixt wrote: > The shell function connects the daemon's stderr to its consumers via a > FIFO. We cannot just do this: > > read line cat &4 & > > because after the first redirection the pipe is closed and the daemon > could receive SIGPIPE if it writes at the wrong moment. Therefore, we open > the readable end of the FIFO only once on fd 7 in the shell and dup from > there to the stdin of the two consumers. > > [...] > { > - read line > + read line <&7 > echo >&4 "$line" > - cat >&4 & > + cat <&7 >&4 & > + } 7 -Peff