sshserver: flush stream after command dispatch
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 08 Sep 2019 01:02:34 +0200
changeset 42896 7e19b640c53e
parent 42895 bbcaf3a74822
child 42897 d7304434390f
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.
mercurial/wireprotoserver.py
tests/test-bookmarks-corner-case.t
tests/test-ssh-proto.t
--- 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: