Patchwork D10086: dispatch: use detailed exit code 250 for keyboard interrupt

login
register
mail settings
Submitter phabricator
Date March 1, 2021, 10:56 p.m.
Message ID <differential-rev-PHID-DREV-vahwboxvepuahr2ugpb7-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48401/
State Superseded
Headers show

Comments

phabricator - March 1, 2021, 10:56 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Among our users at Google, we're still seeing several percent of
  commands fail with exit code 255. I suspect keyboard interrupts is an
  important remaining reason.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dispatch.py
  tests/test-commandserver.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t
--- a/tests/test-commandserver.t
+++ b/tests/test-commandserver.t
@@ -778,7 +778,7 @@ 
   *** runcommand debugsuicide
   interrupted!
   killed!
-   [255]
+   [250]
 
 #endif
 
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -306,7 +306,10 @@ 
             except IOError as inst:
                 if inst.errno != errno.EPIPE:
                     raise
-            ret = -1
+            if req.ui.configbool(b'ui', b'detailed-exit-code'):
+                ret = 250
+            else:
+                ret = -1
         finally:
             duration = util.timer() - starttime
             req.ui.flush()  # record blocked times