From 28f57933db4873b2f6fcb466e479754aa016de2f Mon Sep 17 00:00:00 2001 From: Peter Rowlands Date: Tue, 16 Nov 2021 13:47:51 +0900 Subject: [PATCH] dulwich: flush stdin channel on asyncssh vendor write --- dvc/scm/git/backend/dulwich/asyncssh_vendor.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dvc/scm/git/backend/dulwich/asyncssh_vendor.py b/dvc/scm/git/backend/dulwich/asyncssh_vendor.py index 6ab515c49..2e42f0f42 100644 --- a/dvc/scm/git/backend/dulwich/asyncssh_vendor.py +++ b/dvc/scm/git/backend/dulwich/asyncssh_vendor.py @@ -41,11 +41,17 @@ class AsyncSSHWrapper(BaseAsyncObject): read = sync_wrapper(_read) - def write(self, data: bytes): + async def _write(self, data: bytes): self.proc.stdin.write(data) + await self.proc.stdin.drain() - def close(self): + write = sync_wrapper(_write) + + async def _close(self): self.conn.close() + await self.conn.wait_closed() + + close = sync_wrapper(_close) # NOTE: Github's SSH server does not strictly comply with the SSH protocol.