diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-10-07 15:49:58 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-10-07 15:49:58 +0300 |
commit | 71c1a05d88c9ac84212d164458c5a501e59be389 (patch) | |
tree | 92081b6a7b8c6333bf97e7f7d0331efce95d2dba | |
parent | 58ea239510530b5ce80aa24cd084b43698309bb4 (diff) |
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.
-rwxr-xr-x | tests/run-tests | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/run-tests b/tests/run-tests index 23fc3d910..6280a5182 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -492,9 +492,12 @@ def main(): # we need to access feature_check's from the same directory as the # run-tests script itself. base_path = os.path.dirname(sys.argv[0]) or "." - res = run_tests(pyb, tests, args, base_path) - if pyb: - pyb.close() + try: + res = run_tests(pyb, tests, args, base_path) + finally: + if pyb: + pyb.close() + if not res: sys.exit(1) |