Date: Sat, 28 Aug 2010 18:42:29 +0400 From: Anonymous <swell.k@gmail.com> To: Alexander Best <arundel@freebsd.org> Cc: freebsd-hackers@freebsd.org Subject: Re: tiny patch to prevent head from closing pipes Message-ID: <86aao694tm.fsf@gmail.com> In-Reply-To: <20100828141625.GA69240@freebsd.org> (Alexander Best's message of "Sat, 28 Aug 2010 14:16:25 %2B0000") References: <20100828141625.GA69240@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Alexander Best <arundel@freebsd.org> writes: > hi there, > > i just had subversion complain about a broken pipe while piping its output > through awk straight to head [1]. i decided to add a switch to head which will > tell it to never close a pipe unless the input has stopped [2]. You can do same with sh(1), e.g. $ svn log | (IFS=; while read li; do [ $((i+=1)) -le 10 ] && echo "$li"; done) versus $ svn log | (IFS=; while read li && [ $((i+=1)) -le 10 ]; do echo "$li"; done) ... svn: Write error: Broken pipe But I think subversion should > there's probably a much more efficient way of discarding the input without > closing the pipe unless the input ceased. it's just a 5 minute hack in order to > see if people find the idea useful or not. ;) Can you give an example of usefulness that does not involve subversion?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86aao694tm.fsf>