Content-Length: 1614 | pFad | http://github.com/postgrespro/testgres/pull/185.patch
thub.com
From f5fe166eec93c2b727b4ee0145eecdf77d9b38d6 Mon Sep 17 00:00:00 2001
From: "d.kovalenko"
Date: Thu, 20 Feb 2025 14:23:34 +0300
Subject: [PATCH] RemoteOperations::exec_command updated
- Exact enumeration of supported 'cmd' types
- Refactoring
---
testgres/operations/remote_ops.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/testgres/operations/remote_ops.py b/testgres/operations/remote_ops.py
index f690e063..a24fce50 100644
--- a/testgres/operations/remote_ops.py
+++ b/testgres/operations/remote_ops.py
@@ -78,14 +78,17 @@ def exec_command(self, cmd, wait_exit=False, verbose=False, expect_error=False,
assert input_prepared is None or (type(input_prepared) == bytes) # noqa: E721
- ssh_cmd = []
- if isinstance(cmd, str):
- ssh_cmd = ['ssh', self.ssh_dest] + self.ssh_args + [cmd]
- elif isinstance(cmd, list):
- ssh_cmd = ['ssh', self.ssh_dest] + self.ssh_args + [subprocess.list2cmdline(cmd)]
+ if type(cmd) == str: # noqa: E721
+ cmd_s = cmd
+ elif type(cmd) == list: # noqa: E721
+ cmd_s = subprocess.list2cmdline(cmd)
else:
raise ValueError("Invalid 'cmd' argument type - {0}".format(type(cmd).__name__))
+ assert type(cmd_s) == str # noqa: E721
+
+ ssh_cmd = ['ssh', self.ssh_dest] + self.ssh_args + [cmd_s]
+
process = subprocess.Popen(ssh_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
assert not (process is None)
if get_process:
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/postgrespro/testgres/pull/185.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy