Skip to content

Commit 7fd2f07

Browse files
RemoteOperations::exec_command updated (#185)
- Exact enumeration of supported 'cmd' types - Refactoring
1 parent 22c4763 commit 7fd2f07

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

testgres/operations/remote_ops.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,17 @@ def exec_command(self, cmd, wait_exit=False, verbose=False, expect_error=False,
7878

7979
assert input_prepared is None or (type(input_prepared) == bytes) # noqa: E721
8080

81-
ssh_cmd = []
82-
if isinstance(cmd, str):
83-
ssh_cmd = ['ssh', self.ssh_dest] + self.ssh_args + [cmd]
84-
elif isinstance(cmd, list):
85-
ssh_cmd = ['ssh', self.ssh_dest] + self.ssh_args + [subprocess.list2cmdline(cmd)]
81+
if type(cmd) == str: # noqa: E721
82+
cmd_s = cmd
83+
elif type(cmd) == list: # noqa: E721
84+
cmd_s = subprocess.list2cmdline(cmd)
8685
else:
8786
raise ValueError("Invalid 'cmd' argument type - {0}".format(type(cmd).__name__))
8887

88+
assert type(cmd_s) == str # noqa: E721
89+
90+
ssh_cmd = ['ssh', self.ssh_dest] + self.ssh_args + [cmd_s]
91+
8992
process = subprocess.Popen(ssh_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
9093
assert not (process is None)
9194
if get_process:

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