changeset 42896:7e19b640c53e

sshserver: flush stream after command dispatch I am not sure why this is not working as expected, but without this client might not see some important output. Without this patch moving some output at transaction closing time makes it disapear for ssh client in various sitaution.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 08 Sep 2019 01:02:34 +0200
parents bbcaf3a74822
children d7304434390f
files mercurial/wireprotoserver.py tests/test-bookmarks-corner-case.t tests/test-ssh-proto.t
diffstat 3 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/wireprotoserver.py	Sun Sep 08 00:11:20 2019 +0200
+++ b/mercurial/wireprotoserver.py	Sun Sep 08 01:02:34 2019 +0200
@@ -657,6 +657,8 @@
                 continue
 
             rsp = wireprotov1server.dispatch(repo, proto, request)
+            repo.ui.fout.flush()
+            repo.ui.ferr.flush()
 
             if isinstance(rsp, bytes):
                 _sshv1respondbytes(fout, rsp)
--- a/tests/test-bookmarks-corner-case.t	Sun Sep 08 00:11:20 2019 +0200
+++ b/tests/test-bookmarks-corner-case.t	Sun Sep 08 01:02:34 2019 +0200
@@ -200,8 +200,8 @@
   $ cat push-output.txt
   pushing to ssh://user@dummy/bookrace-server
   searching for changes
+  remote: setting raced push up
   remote has heads on branch 'default' that are not known locally: f26c3b5167d1
-  remote: setting raced push up
   remote: adding changesets
   remote: adding manifests
   remote: adding file changes
--- a/tests/test-ssh-proto.t	Sun Sep 08 00:11:20 2019 +0200
+++ b/tests/test-ssh-proto.t	Sun Sep 08 01:02:34 2019 +0200
@@ -104,6 +104,7 @@
   $ hg debugserve --sshstdio --logiofd 1 << EOF
   > hello
   > EOF
+  e> flush() -> None
   o> write(4) -> 4:
   o>     440\n
   o> write(440) -> 440:
@@ -119,6 +120,7 @@
   capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
 
   $ cat $TESTTMP/io
+  e> flush() -> None
   o> write(4) -> 4:
   o>     440\n
   o> write(440) -> 440: