# HG changeset patch # User Martin von Zweigbergk # Date 1614706405 28800 # Node ID 6edc8800dbc3310bb2b6b4deb11cadfeaacc20fa # Parent 2f2107c01dee8d9cd0ded70ea319a72e74738ad0 dispatch: use detailed exit code 250 for keyboard interrupt 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 with some fixes for pager handling added ahead of it. Differential Revision: https://phab.mercurial-scm.org/D11628 diff -r 2f2107c01dee -r 6edc8800dbc3 mercurial/dispatch.py --- a/mercurial/dispatch.py Fri Oct 08 13:36:02 2021 -0700 +++ b/mercurial/dispatch.py Tue Mar 02 09:33:25 2021 -0800 @@ -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: diff -r 2f2107c01dee -r 6edc8800dbc3 tests/test-chg.t --- a/tests/test-chg.t Fri Oct 08 13:36:02 2021 -0700 +++ b/tests/test-chg.t Tue Mar 02 09:33:25 2021 -0800 @@ -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 -r 2f2107c01dee -r 6edc8800dbc3 tests/test-commandserver.t --- a/tests/test-commandserver.t Fri Oct 08 13:36:02 2021 -0700 +++ b/tests/test-commandserver.t Tue Mar 02 09:33:25 2021 -0800 @@ -792,7 +792,7 @@ *** runcommand debugsuicide interrupted! killed! - [255] + [250] #endif diff -r 2f2107c01dee -r 6edc8800dbc3 tests/test-nointerrupt.t --- a/tests/test-nointerrupt.t Fri Oct 08 13:36:02 2021 -0700 +++ b/tests/test-nointerrupt.t Tue Mar 02 09:33:25 2021 -0800 @@ -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]