Avoid treating supervisord's SIGTERM as an error in CommandEventHandler

This commit is contained in:
Kristóf Tóth 2019-05-13 14:53:31 +02:00
parent 94dee63a41
commit 3bfe6db036

View File

@ -127,6 +127,9 @@ class CommandEventHandler(PipeIOEventHandler):
@terminate_process_on_failure @terminate_process_on_failure
def _monitor_proc(self): def _monitor_proc(self):
return_code = self._proc.wait() return_code = self._proc.wait()
if return_code == -int(SIGTERM):
# supervisord asked the program to terminate, this is fine
return
if return_code != 0: if return_code != 0:
_, stderr = self._proc.communicate() _, stderr = self._proc.communicate()
raise RuntimeError(f'Subprocess failed ({return_code})! Stderr:\n{stderr.decode()}') raise RuntimeError(f'Subprocess failed ({return_code})! Stderr:\n{stderr.decode()}')