mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-20 13:23:08 +02:00
Tests - Don't hang if spawning taskw fails
This commit is contained in:
parent
3b192cddcf
commit
3f004f547e
1 changed files with 18 additions and 1 deletions
|
@ -108,7 +108,20 @@ def _queue_output(arguments, pidq, outputq):
|
||||||
kwargs = arguments["process"]
|
kwargs = arguments["process"]
|
||||||
input = arguments["input"]
|
input = arguments["input"]
|
||||||
|
|
||||||
|
try:
|
||||||
proc = Popen(**kwargs)
|
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
|
# NOTE If for whatever reason pid is None at the time of access, use the
|
||||||
# following line instead
|
# following line instead
|
||||||
|
@ -161,6 +174,10 @@ def _get_output(arguments, timeout=None):
|
||||||
try:
|
try:
|
||||||
pid = pidq.get(timeout=timeout)
|
pid = pidq.get(timeout=timeout)
|
||||||
except Empty:
|
except Empty:
|
||||||
|
pid = None
|
||||||
|
|
||||||
|
# Process crashed or timed out for some reason
|
||||||
|
if pid is None:
|
||||||
return _retrieve_output(t, output_timeout, outputq,
|
return _retrieve_output(t, output_timeout, outputq,
|
||||||
"TaskWarrior to start")
|
"TaskWarrior to start")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue