mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-12-29 16:25:35 +01:00
Merge 24150: Exit status of null command should be exit status of last cmdsubst.
This commit is contained in:
parent
3ac2becb4f
commit
4736e253be
3 changed files with 17 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
|||
2007-12-09 Barton E. Schaefer <schaefer@zsh.org>
|
||||
|
||||
* 24150 plus unposted: Src/exec.c, Test/D08cmdsubst.ztst:
|
||||
Retain exit status of last non-assignment command substitution
|
||||
across variable assignment processing so that, in the event of
|
||||
no command word to execute, the exit status of the statement is
|
||||
that of the last command substitution (per POSIX).
|
||||
|
||||
2007-12-09 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 24197, Src/utils.c, Src/Modules/datetime.c: interface to
|
||||
|
|
|
@ -1963,7 +1963,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
|
|||
lastval = 0;
|
||||
return;
|
||||
} else {
|
||||
cmdoutval = 0;
|
||||
cmdoutval = lastval;
|
||||
if (varspc)
|
||||
addvars(state, varspc, 0);
|
||||
if (errflag)
|
||||
|
|
|
@ -81,3 +81,11 @@
|
|||
>third: file1.txt file2.txt
|
||||
>fourth: *
|
||||
>fifth: file1.txt file2.txt
|
||||
|
||||
$(exit 0) $(exit 3) || print $?
|
||||
0:empty command uses exit value of last substitution
|
||||
>3
|
||||
|
||||
X=$(exit 2) $(exit 0) || print $?
|
||||
0:variable assignments processed after other substitutions
|
||||
>2
|
||||
|
|
Loading…
Reference in a new issue