| Index: tools/testing/drt-trampoline.py
|
| diff --git a/tools/testing/drt-trampoline.py b/tools/testing/drt-trampoline.py
|
| index ac5b23d690af3de4017eebf27fa14da8ecb55ada..d9b90ff9f5173e947d4baf32e355483e163c5949 100644
|
| --- a/tools/testing/drt-trampoline.py
|
| +++ b/tools/testing/drt-trampoline.py
|
| @@ -89,13 +89,24 @@ def main(argv):
|
| p.terminate()
|
| sys.exit(0)
|
|
|
| - # SIGINT is Ctrl-C.
|
| - signal.signal(signal.SIGINT, signal_handler)
|
| - # SIGTERM is sent by test.dart when a process times out.
|
| - signal.signal(signal.SIGTERM, signal_handler)
|
| - output, error = p.communicate()
|
| - signal.signal(signal.SIGINT, signal.SIG_DFL)
|
| - signal.signal(signal.SIGTERM, signal.SIG_DFL)
|
| + def windows_exit_handler(signal):
|
| + p.terminate()
|
| + sys.exit(0)
|
| +
|
| + if os.name == 'nt'
|
| + try:
|
| + import win32api
|
| + win32api.SetConsoleCtrlHandler(windows_exit_handler, True)
|
| + except ImportError:
|
| + raise Exception("pywin32 not installed")
|
| + else:
|
| + # SIGINT is Ctrl-C.
|
| + signal.signal(signal.SIGINT, signal_handler)
|
| + # SIGTERM is sent by test.dart when a process times out.
|
| + signal.signal(signal.SIGTERM, signal_handler)
|
| + output, error = p.communicate()
|
| + signal.signal(signal.SIGINT, signal.SIG_DFL)
|
| + signal.signal(signal.SIGTERM, signal.SIG_DFL)
|
|
|
| if p.returncode != 0:
|
| raise Exception('Failed to run command. return code=%s' % p.returncode)
|
|
|