Handle signal SIGPIPE as exception

Avoid parent process termination when trying to write to stdin of a closed child process.