Skip to content

Commit 7fa4aa8

Browse files
Merge pull request #170 from dmitry-lipetsk/D20241225_001--remote_ops
RemoteOperations is updated (read_binary, get_file_size)
2 parents 44c5fac + 7c0f184 commit 7fa4aa8

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

testgres/operations/remote_ops.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def read_binary(self, filename, start_pos):
347347
assert type(start_pos) == int # noqa: E721
348348
assert start_pos >= 0
349349

350-
cmd = "tail -c +{} {}".format(start_pos + 1, __class__._escape_path(filename))
350+
cmd = ["tail", "-c", "+{}".format(start_pos + 1), filename]
351351
r = self.exec_command(cmd)
352352
assert type(r) == bytes # noqa: E721
353353
return r
@@ -367,7 +367,7 @@ def get_file_size(self, filename):
367367

368368
assert filename is not None
369369
assert type(filename) == str # noqa: E721
370-
cmd = "du -b " + __class__._escape_path(filename)
370+
cmd = ["du", "-b", filename]
371371

372372
s = self.exec_command(cmd, encoding=get_default_encoding())
373373
assert type(s) == str # noqa: E721
@@ -462,15 +462,6 @@ def db_connect(self, dbname, user, password=None, host="localhost", port=5432):
462462
)
463463
return conn
464464

465-
def _escape_path(path):
466-
assert type(path) == str # noqa: E721
467-
assert path != "" # Ok?
468-
469-
r = "'"
470-
r += path
471-
r += "'"
472-
return r
473-
474465

475466
def normalize_error(error):
476467
if isinstance(error, bytes):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy