Merge pull request #2887 from laloch/sudo-permission-error

Fix exception when trying to send SIGSTOP to finished sudo child
This commit is contained in:
Morten Enemark Lund 2018-10-17 08:44:14 +02:00 committed by GitHub
commit a3a0bf9621
Failed to generate hash of commit
2 changed files with 9 additions and 2 deletions

View file

@ -6,6 +6,10 @@
**Removed:** None
**Fixed:** None
**Fixed:**
* Fixed a bug which under very rare conditions could cause the shell
to die with PermissionError exception while sending SIGSTOP signal
to a child process.
**Security:** None

View file

@ -2419,7 +2419,10 @@ def pause_call_resume(p, f, *args, **kwargs):
hasattr(p, "send_signal") and ON_POSIX and not ON_MSYS and not ON_CYGWIN
)
if can_send_signal:
p.send_signal(signal.SIGSTOP)
try:
p.send_signal(signal.SIGSTOP)
except PermissionError:
pass
try:
f(*args, **kwargs)
except Exception: