3 ms·
> The suppression of SIGPIPE was done in the Go code, not in the Python code. What? Your earlier comment I was responding to mentioned only Python, not Go. A
by loeg 7y ago
> The suppression of SIGPIPE was done in the Go code, not in the Python code.
What? Your earlier comment I was responding to mentioned only Python, not Go. And Python suppresses SIGPIPE:
https://github.com/python/cpython/blob/master/Python/pylifecycle.c#L2382-L2387 https://github.com/python/cpython/blob/master/Python/pylifec... ,
https://github.com/python/cpython/blob/master/Doc/library/signal.rst#note-on-sigpipe https://github.com/python/cpython/blob/master/Doc/library/si...
> Does the POSIX standard mandate that programs receiving EPIPE/SIGPIPE die silently?
Not to my knowledge.
- nneonneo 7y agoPython "knows what it's doing" in the sense that it guarantees that it checks return values from write() and has an exception mechanism to ensure that errors aren't accidentally ignored. Therefore, they can get away with ignoring SIGPIPE because they have the appropriate error checking in place. If you check the linked article, you'll see that it discusses both Python and Go, and mentions suppressing SIGPIPE in the Go code. My original comment did not mention Python for point #2; it was more of a general admonition. (And, like all Internet advice - there are always exceptions if you know what you're doing - it was more of a way to head off newbies who might see signal(SIGPIPE, SIG_IGN) and think it's a good idea!)