zsh-workers
 help / color / mirror / code / Atom feed
* PRINT_EXIT_VALUE option in scripts
@ 2013-05-14 14:15 Vincent Lefevre
  2013-05-14 18:46 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Vincent Lefevre @ 2013-05-14 14:15 UTC (permalink / raw)
  To: zsh-workers

The PRINT_EXIT_VALUE option doesn't work in scripts or when a file
is sourced:

----------------------------------------
#!/usr/bin/env zsh

echo $ZSH_VERSION
setopt PRINT_EXIT_VALUE
/bin/false
echo OK
----------------------------------------

ypig% ./tst
5.0.2
OK
ypig% source ./tst
5.0.2
OK

This was already the case with zsh 4.3.10.

Is this intentional? The man page just says:

   PRINT_EXIT_VALUE (-1)
      Print the exit value of programs with non-zero exit status.

Either the behavior or the documentation should be fixed.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


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

* Re: PRINT_EXIT_VALUE option in scripts
  2013-05-14 14:15 PRINT_EXIT_VALUE option in scripts Vincent Lefevre
@ 2013-05-14 18:46 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2013-05-14 18:46 UTC (permalink / raw)
  To: zsh-workers

On Tue, 14 May 2013 16:15:45 +0200
Vincent Lefevre <vincent@vinc17.net> wrote:
> The PRINT_EXIT_VALUE option doesn't work in scripts or when a file
> is sourced:

Looking at the code it's not entirely clear to me what the determing
factor is, but the following weasel words ought to do it.

diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index ce24a22..60892dd 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -1240,6 +1240,7 @@ pindex(NOPRINTEXITVALUE)
 cindex(exit status, printing)
 item(tt(PRINT_EXIT_VALUE) (tt(-1)))(
 Print the exit value of programs with non-zero exit status.
+This is only available at the command line in interactive shells.
 )
 pindex(RC_QUOTES)
 pindex(NO_RC_QUOTES)

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


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

end of thread, other threads:[~2013-05-14 18:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-14 14:15 PRINT_EXIT_VALUE option in scripts Vincent Lefevre
2013-05-14 18:46 ` Peter Stephenson

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).