Let's consider the following example.
I have a parent process that creates a pipe, spawns a child and read the child's standard output using this pipe. At some point, the parent process is no longer interested in the child's output, and closes the read end of the pipe.
Apparently, if the child keeps writing, will this result in the child process receiving a SIGPIPE
signal.
Question: is there a way to redirect the child's output to /dev/null
so that it still keeps running and producing output, but the parent process can go on doing other things and call waitpid
on the child later? Note that setting the child's SIGPIPE
handler to SIG_IGN
is not an option because I don't have control over the child's signal handlers.