Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Unified Diff: tools/testing/drt-trampoline.py

Issue 11578003: Handle timeouts in drt-trampoline on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698