# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1604464103 28800
#      Tue Nov 03 20:28:23 2020 -0800
# Node ID ee826f43cf4f38a799da2e747fcbda068d2a472e
# Parent  d6279c43fc604b1f3f84a9dcfcd54e0959688e9f
hgweb: don't call sys.exit() in httpservice.run()

If I'm reading the code correctly, `mercurial.server.createservice()`
can return an hgweb service or one of three types of command server
services. The caller then calls `mercurial.server.runservice()`,
passing it the returned service's run method. Only the hgweb service
was calling `sys.exit()`. It has been that way since 8d44649df03b
(refactor ssh server., 2006-06-04). That commit message doesn't
provide any explanation. Let's clean up and have the code follow the
usual return path into the `dispatch` module.

After this patch, there should be no remaining places left where we
call `sys.exit()` except for valid uses in the `dispatch` and `worker`
modules.

Differential Revision: https://phab.mercurial-scm.org/D9272

diff --git a/mercurial/hgweb/__init__.py b/mercurial/hgweb/__init__.py
--- a/mercurial/hgweb/__init__.py
+++ b/mercurial/hgweb/__init__.py
@@ -9,7 +9,6 @@
 from __future__ import absolute_import
 
 import os
-import sys
 
 from ..i18n import _
 
@@ -112,7 +111,6 @@
 
     def run(self):
         self.httpd.serve_forever()
-        sys.exit(0)
 
 
 def createapp(baseui, repo, webconf):