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

Do file descriptors survive to subshell?



Hello,
I run subshell (zsh-5.2-dev-1) and there, an exported variable
containing file descriptor works with cat <&$FD. I was first thinking
there's a bug when read -u $FD -t returned true for it, added bunch of
zwarns() to source, and was surprised that (util.c):

ret = select(fd+1, (SELECT_ARG_2_T) &foofd, NULL, NULL, &expire_tv);


returns 1, i.e. one ready fd in set. It is then when I tried to just
cat from the FD, and it worked. Is it expected? How could the FD
survive, maybe because I do flock() (program util-linux/flock, using
call flock()) on it? But the "survive FD" feature should work only for
"exec zsh-5.2-dev-1", not "zsh-5.2-dev-1", shouldn't it ...

Best regards,
Sebastian Gniazdowski



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