diff options
author | Sam Thursfield <sam@afuera.me.uk> | 2020-03-08 22:17:29 +0100 |
---|---|---|
committer | Sam Thursfield <sam@afuera.me.uk> | 2020-03-09 00:47:15 +0100 |
commit | 4c3c72a2c73a21c5f5bb2dbe6fb9677521af6ce0 (patch) | |
tree | 6e46cedc6113b0f5cf223fbb816589fd92ec7a54 /utils | |
parent | e3302961a2447d5b98f9f795c621f507949d5c2b (diff) | |
download | tracker-4c3c72a2c73a21c5f5bb2dbe6fb9677521af6ce0.tar.gz |
trackertestutils: Fix crash on SIGINT
This code never executed because the sandbox would probably
have already crashed due to the D-Bus daemon exiting before
we wanted it to.
Diffstat (limited to 'utils')
-rw-r--r-- | utils/trackertestutils/__main__.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/utils/trackertestutils/__main__.py b/utils/trackertestutils/__main__.py index 63c594801..e7b10e8ed 100644 --- a/utils/trackertestutils/__main__.py +++ b/utils/trackertestutils/__main__.py @@ -408,13 +408,21 @@ def main(): command = [shell, '-c', ' '.join(shlex.quote(c) for c in args.command)] log.debug("Running: %s", command) - result = subprocess.run(command) + interrupted = False + try: + result = subprocess.run(command) + except KeyboardInterrupt: + interrupted = True if len(miner_watches) > 0: wait_for_miners(miner_watches) - log.debug("Process finished with returncode %i", result.returncode) - sys.exit(result.returncode) + if interrupted: + log.debug("Process exited due to SIGINT") + sys.exit(0) + else: + log.debug("Process finished with returncode %i", result.returncode) + sys.exit(result.returncode) finally: sandbox.stop() if index_tmpdir: |