From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28206 invoked by alias); 24 Nov 2014 10:12:10 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 33790 Received: (qmail 10244 invoked from network); 24 Nov 2014 10:11:58 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f5-b7fc86d0000066b7-d9-54730469a052 Date: Mon, 24 Nov 2014 10:11:52 +0000 From: Peter Stephenson To: zsh workers Subject: Re: TRY_BLOCK_ERROR and exit status Message-id: <20141124101152.39741cc8@pwslap01u.europe.root.pri> In-reply-to: <141123115755.ZM10874@torch.brasslantern.com> References: <5470C427.4050805@thequod.de> <5470CF7C.2000707@thequod.de> <5472040F.8020803@thequod.de> <141123115755.ZM10874@torch.brasslantern.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphluLIzCtJLcpLzFFi42I5/e/4Nd1MluIQg6srVS0ONj9kcmD0WHXw A1MAYxSXTUpqTmZZapG+XQJXxvfPG5kKpnFUnL0X18C4jq2LkZNDQsBE4mfHfCYIW0ziwr31 QHEuDiGBpYwSsz/OY4FwljNJPL5/l7mLkYODRUBV4tB3LZAGNgFDiambZjOC2CJA4ebv/1hA bGEBHYn3n36D2bwC9hL3l3xnB7E5BawkmuZsZ4KY+Y5J4sWVXmaQBL+AvsTVv5+grrCXmHnl DCNEs6DEj8n3wAYxC2hJbN7WxAphy0tsXvOWeQKjwCwkZbOQlM1CUraAkXkVo2hqaXJBcVJ6 rpFecWJucWleul5yfu4mRkgIft3BuPSY1SFGAQ5GJR7eHz2FIUKsiWXFlbmHGCU4mJVEePcx FocI8aYkVlalFuXHF5XmpBYfYmTi4JRqYEz6MaHv2ZeEy1VfH3P77FmowN4luuzBtd1zN9wS VL69m0PNXCj1yLWGTjZDEWfzT4I5v565uIZXzCwIztaT0o9dEmjJOUfW9NnbX4XFk2t3LGlK O2R4855quuVejUuezepblj5YEForFKb+PnVfqtH+yD/m7bMlTx2Ud3rGsYiPZ8rBNS2Nnkos xRmJhlrMRcWJAOtRn8kfAgAA On Sun, 23 Nov 2014 11:57:55 -0800 Bart Schaefer wrote: > On Nov 23, 7:08pm, Mikael Magnusson wrote: > } > } % { $(< foo) } always { TRY_BLOCK_ERROR=0 }; echo hello > } zsh: no such file or directory: foo > } hello > } > } However, I'm not sure how to > } make the construct return false when it failed with a fatal error. > > Arguably a fatal error should set both errflag and lastval nonzero, but > that might require a lot of tiny changes all over the place ... on the > other hand I think always+TRY_BLOCK_ERROR is the only way lastval can > still be examined after errflag has been set, so maybe it would suffice > to handle this there? Yes, probably. > What should the value of lastval ($?) be in this circumstance? The easiest way out is probably to leave it if it's non-zero, else set it to 1. Given that "always" isn't all that widely used, changing it to return the last status of the always block might also work. However, it doesn't look necessary to go that far. pws