From 87cf9307f0c06eb9825f582b23f138cf9921a5fe Mon Sep 17 00:00:00 2001 From: Oleg Blokhin Date: Wed, 21 May 2014 18:18:19 +0400 Subject: [PATCH] fix cron hang on Ctrl+C terminating from terminal --- gluon/newcron.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gluon/newcron.py b/gluon/newcron.py index 47891342..637f8b7e 100644 --- a/gluon/newcron.py +++ b/gluon/newcron.py @@ -48,7 +48,13 @@ def stopcron(): global _cron_stopping _cron_stopping = True while _cron_subprocs: - _cron_subprocs.pop().terminate() + proc = _cron_subprocs.pop() + if proc.poll() is None: + try: + proc.terminate() + except: + import traceback + traceback.print_exc() class extcron(threading.Thread):