Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Suppress print_exit_value for single function

On 5 May 2018 at 17:10, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:

> (Right?  I haven't tested this, I'm just going by your description)

It has a basic practical meaning: feature of various prompts to show a
skull or some red or other indicator of last command ending with error
stops working when sched function always returns 0.

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?

I wrote 2 plugins that resulted in user reporting this problem
(printexitvalue spam). The aim at "user might want reports from background
tasks" is problematic when it's noticed that background tasks malform
foreground $? value. It is possible to suppress this malforming (local
ret=$? at sched function start, return $ret at the end), but then it's not
sched's function own return code, it's repeated foreground $? code, so it
shouldn't be reported. I think proper resolution of this is treating $?
value as sacred. We already are steps back from this status of $? as
various plugins run background code and just return 0. Teaching functions
to not write to $? at C level seems to be very rebellious.

Best regards,
Sebastian Gniazdowski

Messages sorted by: Reverse Date, Date, Thread, Author