diff --git a/test/basetest/utils.py b/test/basetest/utils.py index 36f5a3992..c0781aefb 100644 --- a/test/basetest/utils.py +++ b/test/basetest/utils.py @@ -108,7 +108,20 @@ def _queue_output(arguments, pidq, outputq): kwargs = arguments["process"] input = arguments["input"] - proc = Popen(**kwargs) + try: + proc = Popen(**kwargs) + except OSError as e: + # pid None is read by the main thread as a crash of the process + pidq.put(None) + + outputq.put(( + "", + ("Unexpected exception caught during execution of taskw: '{0}' . " + "If you are running out-of-tree tests set USE_PATH=1 in shell " + "env before execution".format(e)), + 255)) # false exitcode + + return # NOTE If for whatever reason pid is None at the time of access, use the # following line instead @@ -161,6 +174,10 @@ def _get_output(arguments, timeout=None): try: pid = pidq.get(timeout=timeout) except Empty: + pid = None + + # Process crashed or timed out for some reason + if pid is None: return _retrieve_output(t, output_timeout, outputq, "TaskWarrior to start")