Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Question about err_return
- X-seq: zsh-workers 41588
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Radon Rosborough <radon.neon@xxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: Question about err_return
- Date: Wed, 23 Aug 2017 17:56:08 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1503507370; bh=SnBDSSuSW1rnHFbOnv7EphMly+fQZcGuFgVo0cUuwMY=; h=Date:From:To:Subject:In-Reply-To:References; b=XSd47KVtJ41m4mnZMnrIV/C4JxUwqsgWsTVb0F+YaM7eAdBFx1b1Gjlw/Tun2a69d 3UU7etWZRqfe8po5xCMo0ITBwD90pA1AUtvGkYScGwjQsDq370SKMsERmBXExUav+l Q/JukLPZ9f+gz1bPOkdrFsmXbFK6IrDy0d6ITCxDcJIyMp9fxG8VyeU9PLJ7E3IY3Q 3sEpUHTG5aewbFT8GqPF9JiHonhvMRypFVnt0ryKSkMbFnW52oa6/P4nZNyxcAW9tb MbBWbDF3WxLJEhUmLEz6FObJIt14747d2AsVZZg3KDaF26KTRY3coHllrDmlwbXYyV cbZOmI8nQOeKA==
- In-reply-to: <CADB4rJG_ajfBdeC+Cd4YHDhi2pXRr3j7tCXKrV_AvT6+Y7_U7A@mail.gmail.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: <CADB4rJG_ajfBdeC+Cd4YHDhi2pXRr3j7tCXKrV_AvT6+Y7_U7A@mail.gmail.com>
On Sun, 20 Aug 2017 22:28:34 -0700
Radon Rosborough <radon.neon@xxxxxxxxx> wrote:
> Hi all,
>
> I have a question about err_return. Specifically, why does the
> following:
>
> function { setopt err_return; false; echo 'oh no' }
>
> print nothing, while
>
> function { setopt err_return; false; echo 'oh no' } && true
>
> prints 'oh no'? This seems very inconsistent to me, as I would expect
> the result of 'x && true' to be the same as 'x' in all circumstances.
It's probably just a bug that we don't reset the state inside functions.
We did have tests assuming it worked this way, but it's not documented
and not obvious, so I think it makes sense to change it.
I can do this, but I need to be careful about one subtlety: whether
ERR_EXIT is still suppressed in that case. I think the answer is yes
--- it applies globally rather than hierarchically. To go with bash, it
would mean (so far as I can see) this applies even if err_exit is
explicitly set in the function --- i.e. suppression of the effect really
is controlled by internal and not user-visible state.
In that case I'll have to do a bit more work separating out the innards
of the two options.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author