Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: [for consideration] TMPSUFFIX
- X-seq: zsh-workers 39472
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: PATCH: [for consideration] TMPSUFFIX
- Date: Wed, 28 Sep 2016 10:24:17 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=EOLK7ILhRdSsBQiICIUGaD5h+Ws=; b=VOSADb dQIbM7Ifrq4U1FndIqHNCjLUBxMtrMSzCK2DK0XfrDdTre3ygRDmsO0HLVGyAsvX gpgUPKBWtTyn+fI9KEI9gC0p51D4EHYU7z/PH61XLmNCji+6Tnva59pPTdoyJldP vuIcjy7NmVQdQi4QLn+2ryTgRjPaIS3OFH8vQ=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=EOLK7ILhRdSsBQiICIUGaD5h+Ws=; b=dg1pY dK9+R8iAzKINdnzjxYnVTwwf0BKlHYLoonCYyOIJ5TyRpWeumfRw5BRYmL/feRPu Zcp0xkmY8oXLksU4vRyx5MVhfcC1obs9boSaZEI2Bo6NK733TCjtA1hTGWTsG5+l +HObqvWhIDO98hItLGCFUxCWvBhbEUUtop7oKo=
- In-reply-to: <160927122050.ZM13394@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <160925155112.ZM23899@torch.brasslantern.com> <20160926072546.GA28316@fujitsu.shahaf.local2> <160926091922.ZM26758@torch.brasslantern.com> <20160927070039.GA20798@fujitsu.shahaf.local2> <160927122050.ZM13394@torch.brasslantern.com>
Bart Schaefer wrote on Tue, Sep 27, 2016 at 12:20:50 -0700:
> On Sep 27, 7:00am, Daniel Shahaf wrote:
> } Using ERRFLAG_ERROR risks aborting too much code (39154 being a recent
> } example).
>
> I'm not sure that's really a valid example for this case -- the trouble
> there was not that too much code was aborted, rather that because of a
> surrounding use of "eval" not *enough* code was aborted; a scripting
> error.
What can we do to cause enough code to be aborted in that case? Perhaps
something like the following:
[[[
diff --git a/Completion/Base/Core/_dispatch b/Completion/Base/Core/_dispatch
index 3f6fe5b..8c5220f 100644
--- a/Completion/Base/Core/_dispatch
+++ b/Completion/Base/Core/_dispatch
@@ -60,7 +60,13 @@ done
if [[ -n "$comp" && "$name" != "${argv[-1]}" ]]; then
_compskip=patterns
- eval "$comp" && ret=0
+ {
+ eval "$comp" && ret=0
+ } always {
+ if (( TRY_BLOCK_ERROR )); then
+ ... throw the exception ...
+ fi
+ }
[[ "$_compskip" = (all|*patterns*) ]] && return ret
fi
]]]
where the ellipsis throws the exception that occurred in the 'eval'.
(Sidebar: if errflag ever had the ERRFLAG_HARD bit set but the
ERRFLAG_ERROR bit unset, then $TRY_BLOCK_ERROR would be zero; this can't
currently occur because ERRFLAG_HARD always occurs alongside ERRFLAG_ERROR..)
> } A middle way would be to force the simple command that =(:) was part to
> } return 127.
>
> If we were to parallel other redirection errors, the command should
> just return 1. Otherwise I'd say we should report the actual error
> number instead of always 127.
Agreed. (My bad for being unclear: I said "127" but I meant "non-zero".)
> However, I don't see any obvious way to do either of those things from
> inside stringsubst().
Messages sorted by:
Reverse Date,
Date,
Thread,
Author