* [PATCH] return value of assignments with nofork substitution
@ 2023-07-27 0:42 Bart Schaefer
0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2023-07-27 0:42 UTC (permalink / raw)
To: Zsh hackers list
[-- Attachment #1: Type: text/plain, Size: 178 bytes --]
This is for the other test I mentioned having thought of while posting
the previous tests.
Some unrelated incidental changes to the test file, the code change is
only one line.
[-- Attachment #2: nofork-return.txt --]
[-- Type: text/plain, Size: 1875 bytes --]
diff --git b/Src/subst.c a/Src/subst.c
index 0fcc60020..aae178f9e 100644
--- b/Src/subst.c
+++ a/Src/subst.c
@@ -1959,6 +1959,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
/* Execute the shell command */
untokenize(cmdarg);
execstring(cmdarg, 1, 0, "cmdsubst");
+ cmdoutval = lastval;
/* "return" behaves as if in a function */
if (retflag) {
retflag = 0;
diff --git b/Test/D10nofork.ztst a/Test/D10nofork.ztst
index 6e14f343e..738a45b99 100644
--- b/Test/D10nofork.ztst
+++ a/Test/D10nofork.ztst
@@ -73,11 +73,11 @@ F:setting option inside is too late for that substitution
(
cd nofork.tmp
setopt globsubst
- print ${| REPLY=f* }
- print ${| REPLY=f? }*
+ purr ${| REPLY=f* }
+ purr ${| REPLY=f? }*
unsetopt globsubst
- print ${| REPLY=f* }
- print ${| REPLY=f? }*
+ purr ${| REPLY=f* }
+ purr ${| REPLY=f? }*
)
1:globsubst on result
>file1.txt file2.txt
@@ -165,11 +165,11 @@ F:Why not use this error in the previous case as well?
# end PS2 stack tests
- purr $(print outside ${| REPLY=inside })
- purr BEGIN$(print outside ${| REPLY=inside })END
- purr "BEGIN$(print outside ${| REPLY=inside })END"
- purr outside ${| REPLY=$(print inside)}
- purr "outside ${| REPLY=$(print inside)}"
+ purr $(purr outside ${| REPLY=inside })
+ purr BEGIN$(purr outside ${| REPLY=inside })END
+ purr "BEGIN$(purr outside ${| REPLY=inside })END"
+ purr outside ${| REPLY=$(purr inside)}
+ purr "outside ${| REPLY=$(purr inside)}"
0:mixing with forking cmdsubst
>outside inside
>BEGINoutside insideEND
@@ -218,6 +218,10 @@ F:Why not use this error in the previous case as well?
F:status of "print" should hide return
>INNER OUTER 7
+ unset outer
+ outer=${| REPLY=${| return 7}}
+7:return status propages in assignment like $(...)
+
unset outer
purr "${|
outer=OUTER
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-27 0:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-27 0:42 [PATCH] return value of assignments with nofork substitution Bart Schaefer
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).