changeset 35453:44fd4cfc6c0a

worker: handle interrupt on windows After applying suggestions from https://phab.mercurial-scm.org/D1564 to catch all exceptions in the same way I actually broke the handling of KeyboardInterrupt on windows. The reason is that KeyboardInterrupt doesn't dervie from Exception, but BaseException: https://docs.python.org/2/library/exceptions.html starting from python 2.5 Test Plan: Run hg on windows and ctrl-c during a large update. No random exceptions from threads surface in the shell. Previously we'd nearly always get stack traces from some of threads Run tests ./run-tests.py [...] Failed test-convert-svn-encoding.t: output changed # Ran 622 tests, 41 skipped, 1 failed. python hash seed: 2962682116 The test failing seems to have nothing to do with the change and fails on base revision as well Differential Revision: https://phab.mercurial-scm.org/D1718
author Wojciech Lis <wlis@fb.com>
date Mon, 18 Dec 2017 15:18:37 -0800
parents 488634db5928
children 786289423e97
files mercurial/worker.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/worker.py	Mon Dec 18 14:37:00 2017 -0800
+++ b/mercurial/worker.py	Mon Dec 18 15:18:37 2017 -0800
@@ -282,7 +282,7 @@
                 if t.exception is not None:
                     raise t.exception
                 threads.remove(t)
-    except Exception: # re-raises
+    except (Exception, KeyboardInterrupt): # re-raises
         trykillworkers()
         raise
     while not resultqueue.empty():