# HG changeset patch # User Wojciech Lis # Date 2017-12-18 23:18:37 # Node ID 44fd4cfc6c0ad3107cacad10c76ed38bd74948f4 # Parent 488634db5928282dd0ae665f26a46d1eda049dd9 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 diff --git a/mercurial/worker.py b/mercurial/worker.py --- a/mercurial/worker.py +++ b/mercurial/worker.py @@ -282,7 +282,7 @@ def _windowsworker(ui, func, staticargs, 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():