diff -r b7b8a1538161 -r d6279c43fc60 mercurial/commands.py --- a/mercurial/commands.py Tue Nov 03 20:18:26 2020 -0800 +++ b/mercurial/commands.py Tue Nov 03 20:20:49 2020 -0800 @@ -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)