Patchwork D1718: worker: handle interrupt on windows

login
register
mail settings
Submitter phabricator
Date Dec. 18, 2017, 11:19 p.m.
Message ID <differential-rev-PHID-DREV-gikwcbw6iwo77twptbru-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/26340/
State Superseded
Headers show

Comments

phabricator - Dec. 18, 2017, 11:19 p.m.
wlis created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1718

AFFECTED FILES
  mercurial/worker.py

CHANGE DETAILS




To: wlis, #hg-reviewers
Cc: mercurial-devel
phabricator - Dec. 19, 2017, 3:55 a.m.
krbullock accepted this revision.
krbullock added a comment.
This revision is now accepted and ready to land.


  Whoops, queued, thanks.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1718

To: wlis, #hg-reviewers, krbullock
Cc: krbullock, mercurial-devel

Patch

diff --git a/mercurial/worker.py b/mercurial/worker.py
--- a/mercurial/worker.py
+++ b/mercurial/worker.py
@@ -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():