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

Re: Option PRINT_EXIT_VALUE doesn't always work as expected



On 2010-07-31 22:53:45 +0100, Peter Stephenson wrote:
> On Fri, 30 Jul 2010 15:02:04 +0200
> Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> > 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
> 
> The fact that the signal number + 128 is added to get the status isn't
> currently taken account at that point.  It should presumably be
> transparent.

Actually I'm wondering whether this is a good idea. I often do
"program | less" and I often quit "less" before looking at the
end of the output, so that one gets a typical broken pipe, with
a useless "zsh: broken pipe" message.

Perhaps there should be an option (useful only with PRINT_EXIT_VALUE)
to ignore the broken pipe specifically. And/or an option so that
exit information is output only when the last command of a pipeline
exits with a non-zero status.

I'm also wondering whether I still need PRINT_EXIT_VALUE since I now
print the exit status (or signal) in my prompt.

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