Adjusted for review comments

This commit is contained in:
David Murphy 2019-07-31 09:18:33 -06:00
parent 2d20fbe6a5
commit 406d3829f4

View File

@ -807,15 +807,17 @@ class SignalHandlingMultiprocessingProcess(MultiprocessingProcess):
msg += '. Exiting'
log.debug(msg)
if HAS_PSUTIL:
if psutil.pid_exists(self.pid):
try:
process = psutil.Process(self.pid)
if hasattr(process, 'children'):
for child in process.children(recursive=True):
try:
process = psutil.Process(self.pid)
if hasattr(process, 'children'):
for child in process.children(recursive=True):
try:
if child.is_running():
child.terminate()
except psutil.NoSuchProcess:
pass
except psutil.NoSuchProcess:
pass
except psutil.NoSuchProcess:
pass
sys.exit(salt.defaults.exitcodes.EX_OK)
def start(self):