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.

-- 
Stephane


Relevant Pages

  • accessing a pipe from TCL and C, hang in `close/exit
    ... I have a TCL shell script which opens a socket to some remote host, ... and opens a read-converter pipe. ... data arrives on the remote host. ... Now I want to close the channel from C++: ...
    (comp.lang.tcl)
  • I can process my mail!
    ... I figured out how to pipe mail to my own scripts! ... the script as an argument. ... that won't confuse boundaries for message text. ... sendmail, but I'm not that interested in sendmail in particular. ...
    (comp.unix.questions)
  • Re: how do i..
    ... On Sun, 2004-08-22 at 18:31, Mr. Oberoi wrote: ... > error results from the program(shell script) to a file. ... scriptname> filename 2>&1 ... the pipe character is used to "chain" the output of the command on ...
    (Fedora)
  • Re: IO::Pipe and loss of data
    ... May be I cut too much, but as the last run of my big script was ... > show at least how I work to send a message and use the pipe. ... There is a fixed amount of buffer (probably 4K ... for each "server". ...
    (comp.lang.perl.misc)
  • Re: Editing Binary Files
    ... I want to edit a precompiled ... pipe that into ... 'awk' script which searches for the pattern you are ... it is then processed and 'uudecode' is used to get the text back ...
    (comp.unix.questions)