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

[PATCH] return value of assignments with nofork substitution



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.
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


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