Re: Ignoring PIPE signals

From: Stephane CHAZELAS (this.address_at_is.invalid)
Date: 01/17/05

Date: Mon, 17 Jan 2005 10:20:11 +0000

2005-01-17, 21:03(+11), Gyruss:
> My question is, is this inherently bad? Is it acceptable just to ignore the
> PIPE signal and do nothing else? (perhaps I should redirect stdout & stderr
> to /dev/null ???)

A process gets a SIGPIPE, when it writes to a dead pipe. If your
script is supposed to continue working even when that pipe is
closed, then it may be that there is no good reason for that
script to write to the pipe. You could investigate what is the
"write(2)" that causes the script to die.

You could do a:

trap '
 exec fd_connected_to_the_pipe> /dev/null' PIPE

So that every further write to that fd don't write to the closed
pipe again.