pub fn disable_sigpipe() -> Result<()>
Expand description
Disable SIGPIPE for the current process.
Writing to a closed socket may cause a SIGPIPE to be sent to the process (depending on the socket type).
On most platforms this is prevented, either by using the MSG_NOSIGNAL
flag when writing
or by setting the SO_NOSIGPIPE
socket option.
However, if a platform does not support MSG_NOSIGNAL
or SO_NOGSISPIPE
,
the signal needs to be handled or the process will be terminated by the kernel.
Calling disable_sigpipe()
make sure the signal is ignored without terminating the process.