diff --git a/contrib/hg-ssh b/contrib/hg-ssh --- a/contrib/hg-ssh +++ b/contrib/hg-ssh @@ -43,6 +43,9 @@ from mercurial import ( ) def main(): + # Prevent insertion/deletion of CRs + dispatch.initstdio() + cwd = os.getcwd() readonly = False args = sys.argv[1:] diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -83,7 +83,7 @@ class request(object): def run(): "run the command in sys.argv" - _initstdio() + initstdio() req = request(pycompat.sysargv[1:]) err = None try: @@ -112,7 +112,7 @@ def run(): sys.exit(status & 255) if pycompat.ispy3: - def _initstdio(): + def initstdio(): pass def _silencestdio(): @@ -132,7 +132,7 @@ if pycompat.ispy3: except IOError: pass else: - def _initstdio(): + def initstdio(): for fp in (sys.stdin, sys.stdout, sys.stderr): procutil.setbinary(fp) diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -798,10 +798,6 @@ class sshserver(object): hook.redirect(True) ui.fout = repo.ui.fout = ui.ferr - # Prevent insertion/deletion of CRs - procutil.setbinary(self._fin) - procutil.setbinary(self._fout) - def serve_forever(self): self.serveuntil(threading.Event()) sys.exit(0)