[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: detecting broken pipe

From: Kevin Ryde
Subject: Re: detecting broken pipe
Date: Tue, 25 Apr 2006 10:03:00 +1000
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

Dan McMahill <address@hidden> writes:
> So is there an easy way to detect when the pipe was terminated so I
> can avoid crashing?

You can set the SIGPIPE signal to avoid terminating on a broken pipe.
Usually setting it to SIG_IGN is the cleanest, with that a write
throws an EPIPE error.  (Read more in the libc manual.)

As to actually detecting the termination, SIGCHLD might tell you as
soon as the child dies (though you probably have to be careful not to
interfere with the cleanups close-pipe will do).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]