diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -6348,7 +6348,7 @@ ) s = wireprotoserver.sshserver(ui, repo) s.serve_forever() - sys.exit(0) + return service = server.createservice(ui, repo, opts) return server.runservice(opts, initfn=service.init, runfn=service.run) diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -3376,7 +3376,6 @@ s = wireprotoserver.sshserver(ui, repo, logfh=logfh) s.serve_forever() - sys.exit(0) @command(b'debugsetparents', [], _(b'REV1 [REV2]'))