Patchwork ***UNCHECKED*** D9272: hgweb: don't call sys.exit() in httpservice.run()

login
register
mail settings
Submitter phabricator
Date Nov. 4, 2020, 4:44 a.m.
Message ID <differential-rev-PHID-DREV-bs2t6nldnbcjcbgmx3tw-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47544/
State Superseded
Headers show

Comments

phabricator - Nov. 4, 2020, 4:44 a.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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 <https://phab.mercurial-scm.org/rHG8d44649df03b744fa6dbd187d0d22d97d918840e>
  (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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/hgweb/__init__.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/hgweb/__init__.py b/mercurial/hgweb/__init__.py
--- a/mercurial/hgweb/__init__.py
+++ b/mercurial/hgweb/__init__.py
@@ -112,7 +112,6 @@ 
 
     def run(self):
         self.httpd.serve_forever()
-        sys.exit(0)
 
 
 def createapp(baseui, repo, webconf):