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

Option PRINT_EXIT_VALUE doesn't always work as expected



Note: every test has been done under Debian/unstable (zsh 4.3.10).

I wonder why PRINT_EXIT_VALUE doesn't always work as expected:

ypig% setopt PRINT_EXIT_VALUE
ypig% false | head -n 1
zsh: exit 1     false | 
zsh: done       head -n 1
ypig% echo $pipestatus
1 0
ypig% false | true
ypig% echo $pipestatus
1 0

Also, if tst is a script that does "exit 141", I get as expected:

ypig% ./tst | head -n 1
zsh: exit 141   ./tst | 
zsh: done       head -n 1
ypig% echo $pipestatus
141 0

but if tst does "kill -PIPE $$", I get:

ypig% ./tst | head -n 1
ypig% echo $pipestatus
141 0

Actually, under some conditions, zsh knows that a process has been
killed with a signal:

ypig% svn log | cat | head -n 1
------------------------------------------------------------------------
svn: Write error: Broken pipe
zsh: exit 1       svn log | 
zsh: broken pipe  cat | 
zsh: done         head -n 1

How to make this always work?
Is this due to some bug in zsh?

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



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