From 004550a190ed46c99bdac6b003da732d565bfe6d Mon Sep 17 00:00:00 2001 From: mtkennerly Date: Tue, 28 Mar 2023 15:50:54 +0800 Subject: [PATCH] #2: Split command before executing --- action.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action.py b/action.py index d37d22f..e2fb429 100644 --- a/action.py +++ b/action.py @@ -1,10 +1,11 @@ import os +import shlex import subprocess def run_command(command: str) -> str: print("Running command: {}".format(command)) - result = subprocess.run(command, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + result = subprocess.run(shlex.split(command), check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return result.stdout.decode("utf-8").strip()