From 3bfe6db036b1bf0f0676f8b5fa2b05e0cad2aa6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Mon, 13 May 2019 14:53:31 +0200 Subject: [PATCH] Avoid treating supervisord's SIGTERM as an error in CommandEventHandler --- lib/tfw/components/pipe_io_event_handler.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/tfw/components/pipe_io_event_handler.py b/lib/tfw/components/pipe_io_event_handler.py index d0eda41..f9cd567 100644 --- a/lib/tfw/components/pipe_io_event_handler.py +++ b/lib/tfw/components/pipe_io_event_handler.py @@ -127,6 +127,9 @@ class CommandEventHandler(PipeIOEventHandler): @terminate_process_on_failure def _monitor_proc(self): return_code = self._proc.wait() + if return_code == -int(SIGTERM): + # supervisord asked the program to terminate, this is fine + return if return_code != 0: _, stderr = self._proc.communicate() raise RuntimeError(f'Subprocess failed ({return_code})! Stderr:\n{stderr.decode()}')