diff --git a/src/remote_ops.py b/src/remote_ops.py index 40bce62..c2e2164 100644 --- a/src/remote_ops.py +++ b/src/remote_ops.py @@ -774,16 +774,13 @@ def _build_cmdline(cmd, exec_env: typing.Dict = None) -> str: return cmdline @staticmethod - def _ensure_cmdline(cmd) -> typing.List[str]: + def _ensure_cmdline(cmd) -> str: if type(cmd) is str: - cmd_s = cmd - elif type(cmd) is list: - cmd_s = subprocess.list2cmdline(cmd) - else: - raise ValueError("Invalid 'cmd' argument type - {0}".format(type(cmd).__name__)) + return cmd + if type(cmd) is list: + return subprocess.list2cmdline(cmd) - assert type(cmd_s) is str - return cmd_s + raise ValueError("Invalid 'cmd' argument type - {0}".format(type(cmd).__name__)) @staticmethod def _create_exec_env_list(exec_env: typing.Dict) -> typing.List[str]: