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

Re: subprocess



On Sat, 2020-06-06 at 11:19 -0700, Bart Schaefer wrote:
> On Fri, Jun 5, 2020 at 6:01 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> > > On 6/5/20, Pier Paolo Grassi <pierpaolog@xxxxxxxxx> wrote:
> > > > efe() cat $1
> > > > efe <(seq 1 10) | wc -l
> > > > cat: /proc/self/fd/13: No such file or directory
>
> A named function on the left side of a pipeline becomes its own "job",
> where all descriptors above 10 are closed.

Itʼs this call here.

How ahout simply reordering so we tidy up after the function is called?
That fixes the problem, hard to see how that can cause a leak...?

pws

diff --git a/Src/exec.c b/Src/exec.c
index 2b8e2167f..53d3aa048 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3969,8 +3969,8 @@ execcmd_exec(Estate state, Execcmd_params eparams,
 
 	    if (is_shfunc) {
 		/* It's a shell function */
-		pipecleanfilelist(filelist, 0);
 		execshfunc((Shfunc) hn, args);
+		pipecleanfilelist(filelist, 0);
 	    } else {
 		/* It's a builtin */
 		LinkList assigns = (LinkList)0;



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