Skip to content

Commit 71c1a05

Browse files
committed
tests/run-tests: Close device under test using "finally".
We want to close communication object even if there were exceptions somewhere in the code. This is important for --device exec:/execpty: which may otherwise leave processing running in the background.
1 parent 58ea239 commit 71c1a05

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/run-tests

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,12 @@ def main():
492492
# we need to access feature_check's from the same directory as the
493493
# run-tests script itself.
494494
base_path = os.path.dirname(sys.argv[0]) or "."
495-
res = run_tests(pyb, tests, args, base_path)
496-
if pyb:
497-
pyb.close()
495+
try:
496+
res = run_tests(pyb, tests, args, base_path)
497+
finally:
498+
if pyb:
499+
pyb.close()
500+
498501
if not res:
499502
sys.exit(1)
500503

0 commit comments

Comments
 (0)