diff --git a/hacking/nix/scope/plat-utils/qemu/automate_simple.py b/hacking/nix/scope/plat-utils/qemu/automate_simple.py index 3e68c25ad..dffbf7152 100644 --- a/hacking/nix/scope/plat-utils/qemu/automate_simple.py +++ b/hacking/nix/scope/plat-utils/qemu/automate_simple.py @@ -18,14 +18,17 @@ def main(): def run(args): child = pexpect.spawn(args.simulate, encoding='utf-8') child.logfile = sys.stdout - ix = child.expect(['TEST_PASS', 'TEST_FAIL', pexpect.TIMEOUT], timeout=args.timeout) - print() - if ix != 0: - if ix == 1: - sys.exit('> test reported failure') - if ix == 2: - sys.exit('> test timed out') - assert False + try: + ix = child.expect(['TEST_PASS', 'TEST_FAIL', pexpect.TIMEOUT], timeout=args.timeout) + print() + if ix != 0: + if ix == 1: + sys.exit('> test reported failure') + if ix == 2: + sys.exit('> test timed out') + assert False + except KeyboardInterrupt: + sys.exit('> interrupted') if __name__ == '__main__': main()