mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-19 02:29:40 +00:00
sh: Pass $? to command substitution containing compound/multiple commands.
Example: false; echo $(echo $?; :)
This commit is contained in:
parent
1cc20081df
commit
925420d09c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=245422
@ -624,8 +624,8 @@ evalbackcmd(union node *n, struct backcmd *result)
|
||||
exitstatus = 0;
|
||||
goto out;
|
||||
}
|
||||
exitstatus = oexitstatus;
|
||||
if (is_valid_fast_cmdsubst(n)) {
|
||||
exitstatus = oexitstatus;
|
||||
savelocalvars = localvars;
|
||||
localvars = NULL;
|
||||
forcelocal++;
|
||||
@ -649,7 +649,6 @@ evalbackcmd(union node *n, struct backcmd *result)
|
||||
poplocalvars();
|
||||
localvars = savelocalvars;
|
||||
} else {
|
||||
exitstatus = 0;
|
||||
if (pipe(pip) < 0)
|
||||
error("Pipe call failed: %s", strerror(errno));
|
||||
jp = makejob(n, 1);
|
||||
|
5
tools/regression/bin/sh/expansion/cmdsubst17.0
Normal file
5
tools/regression/bin/sh/expansion/cmdsubst17.0
Normal file
@ -0,0 +1,5 @@
|
||||
# $FreeBSD$
|
||||
|
||||
f() { return 3; }
|
||||
f
|
||||
[ `echo $?; :` = 3 ]
|
Loading…
Reference in New Issue
Block a user