From 25f2b75b1f7212572007dc3e6f42492b76325cc9 Mon Sep 17 00:00:00 2001 From: Selwin Ong Date: Sun, 23 Sep 2018 20:56:40 +0700 Subject: [PATCH] Horse should exit with return code 1 if it raises an exception --- rq/worker.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/rq/worker.py b/rq/worker.py index 13407e3..d1531a3 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -675,10 +675,13 @@ class Worker(object): self._is_horse = True self.log = logger self.perform_job(job, queue) - finally: - # os._exit() is the way to exit from childs after a fork(), in - # constrast to the regular sys.exit() - os._exit(0) + except: # noqa + # Horse does not terminate properly + os._exit(1) + + # os._exit() is the way to exit from childs after a fork(), in + # constrast to the regular sys.exit() + os._exit(0) def setup_work_horse_signals(self): """Setup signal handing for the newly spawned work horse."""