comparison mercurial/wireprotoserver.py @ 45818:b7b8a1538161

httpservice: move sys.exit() out of serve_forever() This is a simple refactoring to show the callers of the method, so it's easier to reason about the impact of removing the `sys.exit()` calls in subsequent patches. Differential Revision: https://phab.mercurial-scm.org/D9270
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 03 Nov 2020 20:18:26 -0800
parents 8ff1ecfadcd1
children 71443f742886
comparison
equal deleted inserted replaced
45817:58e7ee23ddbd 45818:b7b8a1538161
6 6
7 from __future__ import absolute_import 7 from __future__ import absolute_import
8 8
9 import contextlib 9 import contextlib
10 import struct 10 import struct
11 import sys
12 import threading 11 import threading
13 12
14 from .i18n import _ 13 from .i18n import _
15 from . import ( 14 from . import (
16 encoding, 15 encoding,
849 ) 848 )
850 849
851 def serve_forever(self): 850 def serve_forever(self):
852 self.serveuntil(threading.Event()) 851 self.serveuntil(threading.Event())
853 self._ui.restorefinout(self._fin, self._fout) 852 self._ui.restorefinout(self._fin, self._fout)
854 sys.exit(0)
855 853
856 def serveuntil(self, ev): 854 def serveuntil(self, ev):
857 """Serve until a threading.Event is set.""" 855 """Serve until a threading.Event is set."""
858 _runsshserver(self._ui, self._repo, self._fin, self._fout, ev) 856 _runsshserver(self._ui, self._repo, self._fin, self._fout, ev)