mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
Merge branch 'mitnk-fix-killpg-crash-on-osx'
This commit is contained in:
commit
76ee929676
2 changed files with 20 additions and 5 deletions
|
@ -43,6 +43,8 @@ Current Developments
|
|||
functions
|
||||
* The --shell-type CLI flag now takes precedence over $SHELL_TYPE specified in
|
||||
.xonshrc
|
||||
* Fixed an issue about ``os.killpg()`` on OS X which caused Xonsh crash with
|
||||
occasionlity
|
||||
|
||||
**Security:** None
|
||||
|
||||
|
|
|
@ -6,13 +6,29 @@ import time
|
|||
import signal
|
||||
import builtins
|
||||
from subprocess import TimeoutExpired, check_output
|
||||
from io import BytesIO
|
||||
from collections import deque
|
||||
|
||||
from xonsh.tools import ON_WINDOWS
|
||||
from xonsh.platform import ON_DARWIN, ON_WINDOWS
|
||||
|
||||
tasks = deque()
|
||||
|
||||
|
||||
if ON_DARWIN:
|
||||
def _send_signal(job, signal):
|
||||
# On OS X, os.killpg() may cause PermissionError when there are
|
||||
# any zombie processes in the process group.
|
||||
# See github issue #1012 for details
|
||||
for pid in job['pids']:
|
||||
os.kill(pid, signal)
|
||||
|
||||
elif ON_WINDOWS:
|
||||
pass
|
||||
|
||||
else:
|
||||
def _send_signal(job, signal):
|
||||
os.killpg(job['pgrp'], signal)
|
||||
|
||||
|
||||
if ON_WINDOWS:
|
||||
def _continue(job):
|
||||
job['status'] = "running"
|
||||
|
@ -60,9 +76,6 @@ else:
|
|||
def _kill(job):
|
||||
_send_signal(job, signal.SIGKILL)
|
||||
|
||||
def _send_signal(job, signal):
|
||||
os.killpg(job['pgrp'], signal)
|
||||
|
||||
def ignore_sigtstp():
|
||||
signal.signal(signal.SIGTSTP, signal.SIG_IGN)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue