[PATCH] chgserver: do not print traceback on SystemExit

Jun Wu quark at fb.com
Sun Apr 10 00:42:59 UTC 2016


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1460248929 -3600
#      Sun Apr 10 01:42:09 2016 +0100
# Node ID 3efb9e44023397f212437d89bfd7268cb5a15df6
# Parent  a212504cf958742becab6fe518dab9b838f5bbf4
chgserver: do not print traceback on SystemExit

Before the patch, if some extension uses "sys.exit", chg will print an extra
backtrace. We have ignored KeyboardInterrupt already, and it makes It makes
sense to ignore SystemExit as well.

This patch addresses the issue by adding SystemExit to the ignoring list.

diff --git a/hgext/chgserver.py b/hgext/chgserver.py
--- a/hgext/chgserver.py
+++ b/hgext/chgserver.py
@@ -559,7 +559,7 @@
             except IOError as inst:
                 if inst.errno != errno.EPIPE:
                     raise
-            except KeyboardInterrupt:
+            except (KeyboardInterrupt, SystemExit):
                 pass
             finally:
                 sv.cleanup()


More information about the Mercurial-devel mailing list