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

Re: <(...), >(...) and fds above 9



2019-07-01 16:28:28 +0100, Peter Stephenson:
[...]
> Looks like =(...) doesn't call closem() at all when
> forking, hence the difference in behaviour.  So
> =(...) is the odd one out.
[...]

But is there a good reason why we should close those fds?

I had to work around it in my case (something like:
join <(sort /dev/fd/$fd) <(sort /dev/fd/$fd2)
)


Another difference is that the stdin redirection to /dev/null is
not done for the =(...) form:

$ zsh -c 'cat =(ls -l /proc/self/fd)'
total 0
lrwx------ 1 stephane stephane 64 Jul  1 17:17 0 -> /dev/pts/13
l-wx------ 1 stephane stephane 64 Jul  1 17:17 1 -> /tmp/zshiMCdiC
lrwx------ 1 stephane stephane 64 Jul  1 17:17 2 -> /dev/pts/13
lr-x------ 1 stephane stephane 64 Jul  1 17:17 3 -> /proc/818/fd
$ zsh -c 'cat <(ls -l /proc/self/fd)'
total 0
lrwx------ 1 stephane stephane 64 Jul  1 17:17 0 -> /dev/null
l-wx------ 1 stephane stephane 64 Jul  1 17:17 1 -> pipe:[2995406]
lrwx------ 1 stephane stephane 64 Jul  1 17:17 2 -> /dev/pts/13
lr-x------ 1 stephane stephane 64 Jul  1 17:17 3 -> /proc/829/fd

-- 
Stephane



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