Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Suppress print_exit_value for single function
- X-seq: zsh-users 23385
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Suppress print_exit_value for single function
- Date: Sat, 5 May 2018 15:10:54 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=IZQxJ3 77yhTC+o3sSFq5h7SQO2R/Pm90GIIpFlhs4/4=; b=MPz5O/T91Fnn4wofNJB1AB 3FqmxNKH203nCD3Grb5VuBEMbPym1S3U7KAX3N8u9oYlUH2XrpEpe3OlGerq/Y2+ z1VBxTOvCq3z/+V203xeNrhc/Vh2hoBdmrmy/no9YxmrB2Fabock36gjlZSFEuoO aGokA8TzGBOQi2uVjHji8E1+ZXTJo0VfN7tTYbPnh9tCT/wFVpVCxPnYKFvSipUH zqDxBhaX+DTg7DwmYRuw5XnNhzMUScCKSTqXObhTJFO95TBv1FYVWnDTIrvZELSw 1HVdPPHPXD7U8++W8M0WAjEhJ2vS5mywjA2YAtC1aBERXfgoVWd1w/SHtMLwkI8w ==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=IZQxJ3 77yhTC+o3sSFq5h7SQO2R/Pm90GIIpFlhs4/4=; b=jQVR2qmIZ4e6J+3TpFoICK uroevrSM337DvbbgRIvDB0HgDKvZUATj25kOa3GnGxRzdJD+LSatYYXbPV59xK0H P9iLQCajmKQEpZHEscMLQpDxX4lzW5tR4nZdYgNf6oI/6pJNxZNA+F/Lp7WUTZmR 7IMIIvp04syiKjkw/B+3+qqqPWINjxz6sknQV2nK77csf9SdaBHSuugQ7Wu6GsHx gwBWSmCTfllbNaffiSdXoHYkzHlN8tOwID3PmYhETDXFqloeYQBm9B6yxebYsJG9 4L9tUMStFmBt52Lnw+3BWdh0kZ2jG86rFrPUViRbnJaLumm2GZljU7WXGFp75QPQ ==
- In-reply-to: <CAKc7PVBUGJqa19ix_qwDE+mtvTwYfZPfQ4LPNfUT67jGtFZx7w@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVBUGJqa19ix_qwDE+mtvTwYfZPfQ4LPNfUT67jGtFZx7w@mail.gmail.com>
Sebastian Gniazdowski wrote on Sun, Apr 29, 2018 at 20:42:43 +0200:
> Hello,
> in a 1-second sched function, I do:
>
Thanks for including the example code downthread.
> __ret=$?
> ...
> return $__ret
>
> This solves $? malforming by background task. However, for `setopt
> print_exit_value', this leads to constant "zsh: Exit 1" message, every
> second.
>
I'm not sure that this is a problem. The user opted in to being notified of
errors; there was an error; it was notified of. If anything, isn't the bug
here that the diagnostic, "zsh: exit 1", neglects to specify the name of the
function that returned that value?
> Can I block `setopt print_exit_value' effects for this sched function or to
> all sched functions in general? I think a feature could be added for this,
> it looks very reasonable and useful.
The answer ought to be "If you don't want sched functions to result in stderr
spam, have your sched functions return zero.", except it sounds like doing that
will override the $? variable of the main shell, creating a race condition:
% echo start && make && echo end
[at 12:00] start
[go have some coffee]
[at 12:03] a 'sched' function returns non-zero
[at 12:05] 'make' finishes successfully, but "end" doesn't get printed
(Right? I haven't tested this, I'm just going by your description)
So, isn't the answer to that to teach the C code not to write the return value
of a sched function to the global value of $? — but to keep printing
printexitvalue warnings for sched functions?
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author