From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 28 14:45:32 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67D131065694 for ; Sat, 28 Aug 2010 14:45:32 +0000 (UTC) (envelope-from swell.k@gmail.com) Received: from mail-pw0-f54.google.com (mail-pw0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 3A9178FC16 for ; Sat, 28 Aug 2010 14:45:31 +0000 (UTC) Received: by pwi8 with SMTP id 8so1811306pwi.13 for ; Sat, 28 Aug 2010 07:45:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type; bh=2U2FMVUxfUtmB7X1kIwAD7tBbjFOQxf3s87DRO5UnbQ=; b=nl3svFAZ+xT3qlnSDLqDTdll4zWs51vCLhlkOWaB/hPv6nEqni3iWPxJA9VUvNV6YC MPNs2y6XpqxLB8bG/UKW/9yJKvzr4Ls9hbXjkWC7L+LZbA7wQbPlRy7ut3b7PO9X2cMZ z3pbzobWkg0y2uB0R8pgzJm+6M1PPHzvxJKfg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=mVToOx3Pu+aeKR3+/D4AiMFHU3EmgU1NA8yDbyoFBBoMiZEq32P0RRjauwV434ga7z dWLUKMGoATgidoxrKrgnGVQ5ifT+7khvsvHiJe7P6xLK68pBHMWSTVg/KirOajcFgkqX 0AMur2LB14TuIK9bTNgNs5YeLKXQFFhpUj1g0= Received: by 10.115.107.7 with SMTP id j7mr2186482wam.107.1283006731447; Sat, 28 Aug 2010 07:45:31 -0700 (PDT) Received: from localhost ([120.50.40.184]) by mx.google.com with ESMTPS id k23sm9165678waf.5.2010.08.28.07.45.27 (version=SSLv3 cipher=RC4-MD5); Sat, 28 Aug 2010 07:45:30 -0700 (PDT) From: Anonymous To: Alexander Best References: <20100828141625.GA69240@freebsd.org> Date: Sat, 28 Aug 2010 18:42:29 +0400 In-Reply-To: <20100828141625.GA69240@freebsd.org> (Alexander Best's message of "Sat, 28 Aug 2010 14:16:25 +0000") Message-ID: <86aao694tm.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-hackers@freebsd.org Subject: Re: tiny patch to prevent head from closing pipes X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Aug 2010 14:45:32 -0000 Alexander Best 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?