mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #50212 from dwoz/test_no_fail
Do not fail if process already ended
This commit is contained in:
commit
6b4e07be03
1 changed files with 5 additions and 1 deletions
|
@ -1548,7 +1548,11 @@ def win32_kill_process_tree(pid, sig=signal.SIGTERM, include_parent=True,
|
|||
'''
|
||||
if pid == os.getpid():
|
||||
raise RuntimeError("I refuse to kill myself")
|
||||
parent = psutil.Process(pid)
|
||||
try:
|
||||
parent = psutil.Process(pid)
|
||||
except psutil.NoSuchProcess:
|
||||
log.debug("PID not found alive: %d", pid)
|
||||
return ([], [])
|
||||
children = parent.children(recursive=True)
|
||||
if include_parent:
|
||||
children.append(parent)
|
||||
|
|
Loading…
Add table
Reference in a new issue