diff options
Diffstat (limited to 'scripts/Expect.py')
-rwxr-xr-x | scripts/Expect.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/Expect.py b/scripts/Expect.py index 694d1cdfbeb..985e5c80e5b 100755 --- a/scripts/Expect.py +++ b/scripts/Expect.py @@ -329,9 +329,14 @@ def cleanup(): except: pass processes.clear() - atexit.register(cleanup) +def signal_handler(signal, frame): + cleanup() + sys.exit(0) +signal.signal(signal.SIGINT, signal_handler) +signal.signal(signal.SIGTERM, signal_handler) + class Expect (object): def __init__(self, command, startReader = True, timeout=30, logfile=None, mapping = None, desc = None, cwd = None, env = None): self.buf = "" # The part before the match |