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

Re: print_exit_value unset in an scheduled function, yet still active



On Thu, Sep 26, 2019 at 12:23 PM Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
>
> Hello,
> func() { print $options[printexitvalue] $options[shglob]; false }
> setopt printexitvalue; sched +0 func
>
>
> So the printexitvalue is unset inside the scheduled function, yet it's
> still being active (outside?).

I'm not sure which part you think is wrong here.

Even if, inside the function, printexitvalue is not active, the
function itself returns nonzero here, because "false" is the last
statement; so that exit value will be printed even though the exit
value of "false" is not.

If the question instead is "why did printexitvalue become unset inside
the function":  It's always turned off on entry to a function, so that
only the exit value of the function itself will later be printed,
exactly as happened here.



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