From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25795 invoked by alias); 30 Jul 2010 13:08:26 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15211 Received: (qmail 3673 invoked from network); 30 Jul 2010 13:08:23 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at vinc17.net does not designate permitted sender hosts) Date: Fri, 30 Jul 2010 15:02:04 +0200 From: Vincent Lefevre To: zsh-users@zsh.org Subject: Option PRINT_EXIT_VALUE doesn't always work as expected Message-ID: <20100730130204.GC8757@ypig.lip.ens-lyon.fr> Mail-Followup-To: zsh-users@zsh.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Mailer-Info: http://www.vinc17.org/mutt/ User-Agent: Mutt/1.5.20-6087-vl-r35499 (2010-07-18) Note: every test has been done under Debian/unstable (zsh 4.3.10). I wonder why PRINT_EXIT_VALUE doesn't always work as expected: ypig% setopt PRINT_EXIT_VALUE ypig% false | head -n 1 zsh: exit 1 false | zsh: done head -n 1 ypig% echo $pipestatus 1 0 ypig% false | true ypig% echo $pipestatus 1 0 Also, if tst is a script that does "exit 141", I get as expected: ypig% ./tst | head -n 1 zsh: exit 141 ./tst | zsh: done head -n 1 ypig% echo $pipestatus 141 0 but if tst does "kill -PIPE $$", I get: ypig% ./tst | head -n 1 ypig% echo $pipestatus 141 0 Actually, under some conditions, zsh knows that a process has been killed with a signal: ypig% svn log | cat | head -n 1 ------------------------------------------------------------------------ svn: Write error: Broken pipe zsh: exit 1 svn log | zsh: broken pipe cat | zsh: done head -n 1 How to make this always work? Is this due to some bug in zsh? -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)