Try/except psutil process access in OSX

Refs https://github.com/saltstack/qa/issues/244
This commit is contained in:
Mike Place 2016-09-20 14:35:25 +09:00
parent 098cf87a6b
commit d0f44c95f5
No known key found for this signature in database
GPG Key ID: 9136F4F13705CFD3

View File

@ -184,10 +184,16 @@ except ImportError:
kill_children(children) kill_children(children)
if children: if children:
psutil.wait_procs(children, timeout=10, callback=lambda proc: kill_children(children, terminate=True)) try:
psutil.wait_procs(children, timeout=10, callback=lambda proc: kill_children(children, terminate=True))
except psutil.AccessDenied:
kill_children(children, terminate=True)
if children: if children:
psutil.wait_procs(children, timeout=5, callback=lambda proc: kill_children(children, kill=True)) try:
psutil.wait_procs(children, timeout=5, callback=lambda proc: kill_children(children, kill=True))
except psutils.AccessDenied:
kill_children(children, kill=True)
SYS_TMP_DIR = os.path.realpath( SYS_TMP_DIR = os.path.realpath(
# Avoid ${TMPDIR} and gettempdir() on MacOS as they yield a base path too long # Avoid ${TMPDIR} and gettempdir() on MacOS as they yield a base path too long