2024-11-15 22:39:49 +01:00
|
|
|
import subprocess
|
|
|
|
|
|
|
|
|
2024-12-18 01:41:12 +01:00
|
|
|
def run_command(command: str, isPython: bool = False) -> str:
|
2024-11-15 22:39:49 +01:00
|
|
|
process = subprocess.run(
|
|
|
|
command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
|
|
)
|
2024-12-18 01:41:12 +01:00
|
|
|
return_massage = ""
|
|
|
|
if process.returncode != 0 and not isPython:
|
2024-11-15 22:39:49 +01:00
|
|
|
print(f"Error running command: {command}")
|
2024-12-18 01:41:12 +01:00
|
|
|
return_massage = process.stderr.decode()
|
|
|
|
return_massage = process.stdout.decode()
|
|
|
|
return return_massage
|