mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Restore SIGPIPE handler to DFL on POpen
Python sets the SIGPIPE handler to SIG_IGN. On execv() signal handlers are reset to their defaults, EXCEPT those that are SIG_IGN which are left ignored. In Python 3 subprocess.popen explicitly resets the SIGPIPE handler to SIG_DFL, but unfortunately in Python 2.7 it does not. This leads to subprocesses being executed with SIGPIPE ignored. This is often a problem with bash scripts which rely on SIGPIPE to terminate commands in a pipe, but can easily be a problem with other applications. This implements the Python 3 behaviour for Python 2.7 by using a preexec_fn.
This commit is contained in:
committed by
Toshio Kuratomi
parent
1015c50034
commit
f2dccb90e8
2
changelogs/fragments/restore_sigpipe_dfl.yml
Normal file
2
changelogs/fragments/restore_sigpipe_dfl.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- Restore SIGPIPE to SIG_DFL when creating subprocesses to avoid it being ignored under Python 2.
|
||||
Reference in New Issue
Block a user