From 71aed225396ae525f451f4d7a2ea1b573195c755 Mon Sep 17 00:00:00 2001 From: Thomas Nagy Date: Sat, 3 Sep 2016 20:22:43 +0200 Subject: [PATCH] Call killpg only if setsid is enabled --- ChangeLog | 5 +++++ waflib/Utils.py | 8 ++++---- waflib/processor.py | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 857cf165..c46bf43c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +NEW IN WAF 1.9.4 +---------------- +* Enable 'waf dist' in arbitrary paths #1806 +* Handle subprocess timeouts in Python 3.3 #1807 + NEW IN WAF 1.9.3 ---------------- * Improve the behaviour of parallel configuration tests (conf.multicheck) #1793 diff --git a/waflib/Utils.py b/waflib/Utils.py index bbab2c80..2ea9ebb1 100644 --- a/waflib/Utils.py +++ b/waflib/Utils.py @@ -865,9 +865,9 @@ def run_regular_process(cmd, kwargs, cargs={}): try: out, err = proc.communicate(**cargs) except TimeoutExpired: - try: + if kwargs.get('start_new_session') and hasattr(os, 'killpg'): os.killpg(proc.pid, signal.SIGKILL) - except AttributeError: + else: proc.kill() out, err = proc.communicate() raise TimeoutExpired(proc.args, timeout=cargs['timeout'], output=out, stderr=err) @@ -877,9 +877,9 @@ def run_regular_process(cmd, kwargs, cargs={}): try: status = proc.wait(**cargs) except TimeoutExpired as e: - try: + if kwargs.get('start_new_session') and hasattr(os, 'killpg'): os.killpg(proc.pid, signal.SIGKILL) - except AttributeError: + else: proc.kill() proc.wait() raise e diff --git a/waflib/processor.py b/waflib/processor.py index 96e93cfa..184cb5e5 100755 --- a/waflib/processor.py +++ b/waflib/processor.py @@ -34,9 +34,9 @@ def run(): try: out, err = proc.communicate(**cargs) except TimeoutExpired: - try: + if kwargs.get('start_new_session') and hasattr(os, 'killpg'): os.killpg(proc.pid, signal.SIGKILL) - except AttributeError: + else: proc.kill() out, err = proc.communicate() raise TimeoutExpired(proc.args, timeout=cargs['timeout'], output=out, stderr=err)