Roland Mainz wrote:

> Roland Mainz wrote:
> > Does anyone know in which conditions "cat" may return an exit code of
> > "141" when writing to a FIFO ?
> 
> The question wasn't 100% correct. It should be: In which conditions can
> the statement "cat foo.txt >myfifo" return an exit code of "141" (e.g.
> either "cat" or the redirection seems to fail but I am not sure (since I
> am doing remote debugging via email... ;-( )) ?

The exit code indicates that the process caught SIGPIPE.  And write(2) says
that SIGPIPE will be sent to a process that tries to write to a pipe or
fifo that isn't open for reading by any process.  But I presume you knew
that.

I don't know offhand how to reproduce that, though, since your command will
block on the open() if nothing's listening on the other end, and should
they have modified their shell to open with O_NONBLOCK, the open will
simply fail.  Perhaps between the open() and the write(), the reader died?

Danek

Reply via email to