zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-users@zsh.org
Subject: Re: Option PRINT_EXIT_VALUE doesn't always work as expected
Date: Sat, 31 Jul 2010 22:53:45 +0100	[thread overview]
Message-ID: <20100731225345.2cad292e@pws-pc> (raw)
In-Reply-To: <20100730130204.GC8757@ypig.lip.ens-lyon.fr>

On Fri, 30 Jul 2010 15:02:04 +0200
Vincent Lefevre <vincent@vinc17.net> 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.

Index: Src/jobs.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.76
diff -p -u -r1.76 jobs.c
--- Src/jobs.c	31 Jul 2010 21:06:12 -0000	1.76
+++ Src/jobs.c	31 Jul 2010 21:47:54 -0000
@@ -873,6 +873,10 @@ printjob(Job jn, int lng, int synch)
 		    sflag = 1;
 		if (job == thisjob && sig == SIGINT)
 		    doputnl = 1;
+		if (isset(PRINTEXITVALUE) && isset(SHINSTDIN)) {
+		    sflag = 1;
+		    skip_print = 0;
+		}
 	    } else if (WIFSTOPPED(pn->status)) {
 		sig = WSTOPSIG(pn->status);
 		if ((int)strlen(sigmsg(sig)) > len)


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


  reply	other threads:[~2010-07-31 21:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-30 13:02 Vincent Lefevre
2010-07-31 21:53 ` Peter Stephenson [this message]
2010-08-19 14:25   ` Vincent Lefevre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100731225345.2cad292e@pws-pc \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).