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

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Mar 1 22:56:39 UTC 2021


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

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



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


More information about the Mercurial-devel mailing list