4 ms·
Not all programs are meant to be used in pipelines. It’s not even entirely accurate to say that that’s EXACTLY how pipelined programs should work; maybe they w
by sfoley 6y ago
Not all programs are meant to be used in pipelines.
It’s not even entirely accurate to say that that’s EXACTLY how pipelined programs should work; maybe they want to do some cleanup before they die. SIGPIPE was essentially created as a hack for naive programs that didn’t properly check the return value of write(). EPIPE should have been enough, it’s a perfectly fine solution.
- inetknght 6y ago> Not all programs are meant to be used in pipelines. I would argue that programs that aren't meant to be used in pipelines aren't well designed programs. > It’s not even entirely accurate to say that that’s EXACTLY how pipelined programs should work; maybe they want to do some cleanup before they die. If you need to do some cleanup before you die, then that's exactly what a signal handler is there for you to do. Nothing stops you from exiting immediately after a signal handler.
- jlokier 6y ago> If you need to do some cleanup before you die, then that's exactly what a signal handler is there for you to do. I challenge you to clean up a temporary directory, like doing "rm -fr $TMPDIR/tmp$SECRET/" except not by running another program, in an async-signal-safe manner inside a SIGPIPE handler which then exits. Hint: You're not allowed to call system(), readdir(), malloc() or any of exec*().