diff --git a/pyproject.toml b/pyproject.toml index 8389e7e..22a2c8f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ authors = [ { name="Shin", email="shin@yixiaoer.sg" }, ] # we cannot use `dynamic` here, because it doesn't work on Python 3.8 -version = "0.1.5" +version = "0.1.6" dependencies = [ "psutil", "fabric", diff --git a/src/tpux/utils.py b/src/tpux/utils.py index 3aeb28a..3d36046 100644 --- a/src/tpux/utils.py +++ b/src/tpux/utils.py @@ -20,7 +20,11 @@ def get_podips() -> List[str]: return [line.rstrip('\n') for line in f] def run_command_on_localhost(command: str, **kwargs) -> None: - result = subprocess.run(command.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env, **kwargs) + if kwargs.get('shell'): + result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env, **kwargs) + else: + result = subprocess.run(command.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env, **kwargs) + if result.returncode != 0: print(f'Command failed: {command}') print(f'Error: {result.stderr.decode()}')