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

Re: Any comment on file descriptor behavior in functions?



Bart Schaefer wrote:
> Specifically zsh-workers/20991:
> 
> > It could be argued that descriptors opened by process substitution
> > should remain open across external command execution within functions;
> > they do, in e.g. bash.
> 
> (But don't in zsh, in case that isn't clear.)

Is this it?  Does it have other effects?

Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.84
diff -u -r1.84 exec.c
--- Src/exec.c	6 Feb 2005 20:36:42 -0000	1.84
+++ Src/exec.c	22 Mar 2005 13:55:17 -0000
@@ -496,7 +496,13 @@
     }
 
     argv = makecline(args);
-    closem(3);
+    /*
+     * At this point we used to:
+     *   closem(3);
+     * which had the effect of closing file descriptors opened
+     * for process substitution.  However, experience suggests
+     * it's better to leave these open for other processes to use.
+     */
     child_unblock();
     if ((int) strlen(arg0) >= PATH_MAX) {
 	zerr("command too long: %s", arg0, 0);

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************



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