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

RE: FIFOs again



  I tried with
>
>   cat <(echo foo)
>
> and confirmed that it's the cat which hangs forever, waiting
> for something
> to open the other end of the pipe for writing.  At least
> that's what seems
> to be happening with Solaris 2.6.
>

Yes, you are right. The correct thing is - open FIFO for read AND write
and close it after command exited. (Opening just for read or write is
not enough and has potentially the same problems).

Probably, we could use the same structure as is used to keep track of
FIFO names for descriptors as well. It should cover the case of
background job as well.

Hmm ... and then again, all of them should be closed in next child ...
why do not we simply use

for(i=3;i++;i<MAX_FD) close(i);

in child? I just discovered that (probably, due to a bug) logon shells
keep one stray open file descriptor that is never closed by shell.

> Keeping the process open in the parent might work, however (there's a
> slight extra subtlety over your code that we need to check the fork
> returned a positive value).

Yes, of course. I think, there is no problem to have it opened as long
as we never actually use it.

-andrej



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