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

Re: exit status 0 after SIGINT



On Tue, 26 Sep 2017 11:57:33 +0100
Martijn Dekker <martijn@xxxxxxxx> wrote:
> % kill -s INT $$ || echo oops
> % echo $?
> 1
> % kill -s INT $$ && echo oops
> % echo $?
> 130
> 
> Both should be 130.

It's probably something like this.  Hard to know under exactly what
circumstance to change the value but leaving it alone if it's already
non-zero doesn't seem too idiotic.

Soureforge is down at the moment.

pws

diff --git a/Src/exec.c b/Src/exec.c
index bd242d1..75a9f2b 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3199,7 +3199,8 @@ execcmd_exec(Estate state, Execcmd_params eparams,
     }
 
     if (errflag) {
-	lastval = 1;
+	if (!lastval)
+	    lastval = 1;
 	if (oautocont >= 0)
 	    opts[AUTOCONTINUE] = oautocont;
 	return;



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