Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
_dispatch (was Re: PATCH: [for consideration] TMPSUFFIX)
- X-seq: zsh-workers 39483
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: _dispatch (was Re: PATCH: [for consideration] TMPSUFFIX)
- Date: Wed, 28 Sep 2016 11:49:17 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=DqSgT6eWBUDl5f8kEY6Zcnb9pk6ezCujJFqsvkTBsHs=; b=HoCn/w1ZAlizuIf8ufJtgYzaRasA2ku3DRRQ2knXR+xQ1OpxJIO3+ju5oVSbDSdgIM ZZhHYEjlEDNGZ5o5Vmo4Gdp/b/hS1artXlVruc0CNEN7o7ZCtXa0Je92DpaQa2eqfDsE uQm9uhy8SEC+gZGisr5nTDXwrerpU9MJ2ERpTSLB5r/+f+DMMa+vCJY/1LhODE4nVlDY hdlkreW3BWKBtKX7vb2jN8uy0JoBMYcAdKobZ/LZ79Rhg5z3Ym2zwMvFbLr6B+Uii7Mk qLcUCs5fyBwdKMO/jtpRpOYpSFBGwetHBy/HSfMw9Os7kPIo6GYYQ6+7lb7sNtKfSHxF 0HfA==
- In-reply-to: <20160928102417.GA2729@fujitsu.shahaf.local2>
- 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> <20160928102417.GA2729@fujitsu.shahaf.local2>
On Sep 28, 10:24am, Daniel Shahaf wrote:
} Subject: Re: PATCH: [for consideration] TMPSUFFIX
}
} Bart Schaefer wrote on Tue, Sep 27, 2016 at 12:20:50 -0700:
} > 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:
}
} + {
} + eval "$comp" && ret=0
} + } always {
} + if (( TRY_BLOCK_ERROR )); then
} + ... throw the exception ...
} + fi
} + }
Sadly, that won't do it either -- TRY_BLOCK_ERROR is not set:
[[[
torch% comp=': ${:}'
torch% { eval "$comp" && print OK } always { print $TRY_BLOCK_ERROR }
zsh: unrecognized modifier
0
torch% print $?
1
torch% comp=': *(#q)(#q)'
torch% { eval "$comp" && echo OK } always { print $TRY_BLOCK_ERROR }
zsh: unknown file attribute: #
0
]]]
The eval captures everything and turns it into nonzero exit status.
The eval is there (and in two other places in _dispatch) because one
can pass a command line as the first argument of compadd:
compdef 'compadd *' f
There might be another way to permit that without eval'ing, but it
would be convoluted.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author