zsh-workers
 help / color / mirror / code / Atom feed
* print_exit_value unset in an scheduled function, yet still active
@ 2019-09-26 19:21 Sebastian Gniazdowski
  2019-09-26 19:49 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Gniazdowski @ 2019-09-26 19:21 UTC (permalink / raw)
  To: Zsh hackers list

Hello,
func() { print $options[printexitvalue] $options[shglob]; false }
setopt printexitvalue; sched +0 func

Output:
off off
zsh: exit 1

setopt shglob; sched +0 func

Output:
off on
zsh: exit 1

So the printexitvalue is unset inside the scheduled function, yet it's
still being active (outside?).

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: print_exit_value unset in an scheduled function, yet still active
  2019-09-26 19:21 print_exit_value unset in an scheduled function, yet still active Sebastian Gniazdowski
@ 2019-09-26 19:49 ` Bart Schaefer
  2019-09-28  8:21   ` Sebastian Gniazdowski
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2019-09-26 19:49 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: Zsh hackers list

On Thu, Sep 26, 2019 at 12:23 PM Sebastian Gniazdowski
<sgniazdowski@gmail.com> 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: print_exit_value unset in an scheduled function, yet still active
  2019-09-26 19:49 ` Bart Schaefer
@ 2019-09-28  8:21   ` Sebastian Gniazdowski
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Gniazdowski @ 2019-09-28  8:21 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

On Thu, 26 Sep 2019 at 21:49, Bart Schaefer <schaefer@brasslantern.com> wrote:
> 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.

Thanks, that was the question.

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-28  8:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-26 19:21 print_exit_value unset in an scheduled function, yet still active Sebastian Gniazdowski
2019-09-26 19:49 ` Bart Schaefer
2019-09-28  8:21   ` Sebastian Gniazdowski

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).