summaryrefslogtreecommitdiff
path: root/utils/lit
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-11-17 23:52:33 +0000
committerReid Kleckner <rnk@google.com>2017-11-17 23:52:33 +0000
commitb287a8d8c2edd929f3b4f25be9c3278d085b54c1 (patch)
treee0a7b37bf0bd6c3ea703b5618de43371c530e54e /utils/lit
parent8e87d92d1dfcde8e342148d4c442eaa5d8a536f1 (diff)
[lit] Try to improve Ctrl-C behavior on Windows
This functionality was broken during a refactor a while back because 'pool' is no longer in scope. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318572 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/lit')
-rw-r--r--utils/lit/lit/run.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/utils/lit/lit/run.py b/utils/lit/lit/run.py
index a4a21234fa3..c4f9eb2d0fc 100644
--- a/utils/lit/lit/run.py
+++ b/utils/lit/lit/run.py
@@ -71,6 +71,16 @@ class Run(object):
(self.lit_config,
self.parallelism_semaphores))
+ # Install a console-control signal handler on Windows.
+ if win32api is not None:
+ def console_ctrl_handler(type):
+ print('\nCtrl-C detected, terminating.')
+ pool.terminate()
+ pool.join()
+ abort_now()
+ return True
+ win32api.SetConsoleCtrlHandler(console_ctrl_handler, True)
+
try:
async_results = [pool.apply_async(worker_run_one_test,
args=(test_index, test),
@@ -126,16 +136,6 @@ class Run(object):
if not self.tests or jobs == 0:
return
- # Install a console-control signal handler on Windows.
- if win32api is not None:
- def console_ctrl_handler(type):
- print('\nCtrl-C detected, terminating.')
- pool.terminate()
- pool.join()
- abort_now()
- return True
- win32api.SetConsoleCtrlHandler(console_ctrl_handler, True)
-
# Save the display object on the runner so that we can update it from
# our task completion callback.
self.display = display