Content-Length: 275574 | pFad | http://github.com/postgrespro/testgres/pull/170/files

8B RemoteOperations is updated (read_binary, get_file_size) by dmitry-lipetsk · Pull Request #170 · postgrespro/testgres · GitHub
Skip to content

RemoteOperations is updated (read_binary, get_file_size) #170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions testgres/operations/remote_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def read_binary(self, filename, start_pos):
assert type(start_pos) == int # noqa: E721
assert start_pos >= 0

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

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

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

def _escape_path(path):
assert type(path) == str # noqa: E721
assert path != "" # Ok?

r = "'"
r += path
r += "'"
return r


def normalize_error(error):
if isinstance(error, bytes):
Expand Down








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/testgres/pull/170/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy