OT: signal and pipeline
This one is for UNIX shell gurus. Pointers to a better forum for the
question are most welcome. This is what is giving me a headache:
I have a small program that only installs a signal handler for SIGHUP,
SIGINT and SIGPIPE and then just loops over sleep(1); printf("hi\n");
If I start the program from the shell and interrupt it with CTRL-C from the
keyboard, the signal handler is called as expected.
If I start it in a pipeline, e.g., myprog | tee myprog.log and press CTRL-C,
then tee gets SIGINT and exits. myprog also terminates but the signal
handler is not called.
Why is the signal handler not invoked? What signal does myprog need to look
out for and is there a particular trick needed to catch it?
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at