zsh-workers
 help / color / 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, back to index

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

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git