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

Re: command substitution: zsh waits until command exits



[> zsh-workers]

On Dec 3,  7:15pm, Bart Schaefer wrote:
} Subject: Re: command substitution: zsh waits until command exits
}
} On Dec 4,  2:42am, Vincent Lefevre wrote:
} }
} } Now, if I understand correctly,
} } 
} }   $(false) && echo true
} } 
} } shouldn't output anything because before the &&, there's no command
} } and the command substitution has a non-zero exit status.
} 
} I suspect that what's happening is that zsh is losing the exit status
} on its way from step 2 to step 4 of the expansion sequence

Is it really this easy?  There must be something I'm missing.

Index: Src/exec.c
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/exec.c,v
retrieving revision 1.34
diff -c -r1.34 exec.c
--- Src/exec.c	26 Nov 2007 17:38:13 -0000	1.34
+++ Src/exec.c	4 Dec 2007 04:17:17 -0000
@@ -2331,7 +2331,7 @@
 		    lastval = 0;
 		    return;
 		} else {
-		    cmdoutval = 0;
+		    cmdoutval = lastval;
 		    if (varspc)
 			addvars(state, varspc, 0);
 		    if (errflag)



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