mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-07 15:28:28 +01:00
ssh: support opening files for writing
This commit is contained in:
@@ -251,12 +251,14 @@ class RemoteSSH(RemoteBASE):
|
||||
@contextmanager
|
||||
def open(self, path_info, mode="r", encoding=None):
|
||||
with self.ssh(path_info) as ssh, closing(
|
||||
ssh.sftp.file(path_info.path, mode="r")
|
||||
ssh.sftp.open(path_info.path, mode)
|
||||
) as fd:
|
||||
if mode == "rb":
|
||||
if "b" in mode:
|
||||
yield fd
|
||||
else:
|
||||
yield io.TextIOWrapper(fd, encoding=encoding)
|
||||
yield io.TextIOWrapper(
|
||||
fd, encoding=encoding, write_through=True
|
||||
)
|
||||
|
||||
def list_cache_paths(self):
|
||||
with self.ssh(self.path_info) as ssh:
|
||||
|
||||
Reference in New Issue
Block a user