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

login
register
mail settings
Submitter phabricator
Date Oct. 11, 2021, 11:31 p.m.
Message ID <differential-rev-PHID-DREV-j524nofbcyzrzglwmeap-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49952/
State Superseded
Headers show

Comments

phabricator - Oct. 11, 2021, 11:31 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.
  
  This is a resend of D10086 <https://phab.mercurial-scm.org/D10086> with some fixes for pager handling added
  ahead of it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

CHANGE DETAILS




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

Patch

diff --git a/tests/test-nointerrupt.t b/tests/test-nointerrupt.t
--- a/tests/test-nointerrupt.t
+++ b/tests/test-nointerrupt.t
@@ -66,7 +66,7 @@ 
   $ sh -c "../send-signal.sh INT" &
   $ hg wait-signal
   interrupted!
-  [255]
+  [250]
 
   $ cat >> $HGRCPATH << EOF
   > [experimental]
@@ -77,7 +77,7 @@ 
   $ sh -c "../send-signal.sh INT" &
   $ hg wait-signal
   interrupted!
-  [255]
+  [250]
 
   $ cat >> $HGRCPATH << EOF
   > [experimental]
@@ -91,4 +91,4 @@ 
   press ^C again to terminate immediately (dangerous)
   end of unsafe operation
   interrupted!
-  [255]
+  [250]
diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t
--- a/tests/test-commandserver.t
+++ b/tests/test-commandserver.t
@@ -792,7 +792,7 @@ 
   *** runcommand debugsuicide
   interrupted!
   killed!
-   [255]
+   [250]
 
 #endif
 
diff --git a/tests/test-chg.t b/tests/test-chg.t
--- a/tests/test-chg.t
+++ b/tests/test-chg.t
@@ -188,12 +188,12 @@ 
   $ chg bulkwrite --pager=on --color no --config ui.formatted=True
   paged! 'going to write massive data\n'
   killed! (?)
-  [255]
+  [250]
 
   $ chg bulkwrite --pager=on --color no --config ui.formatted=True
   paged! 'going to write massive data\n'
   killed! (?)
-  [255]
+  [250]
 
   $ cd ..
 
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -316,7 +316,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
             try: