I have created a fifo using C and python programs. The fifo is created in the C program, which does the reading Operation and the writing is done in Python. My question is as follows:
- If my reader(C program) is killed forcefully, my writer keeps writing to the fifo. How can I handle this so that the writer exits when reader is killed?
- When the reader is killed , is a SIGPIPE signal recieved by the writer?
When writing to a pipe with a defunct reader, the writer will receive a SIGPIPE signal. By default, this will kill the process. If the signal is ignored, the write will return error EPIPE. This happens regardless of how the reader died.