webscraper/scripts/run_command.py
paprykdev 388964d497
Some checks are pending
Docker Image CI / build (push) Waiting to run
feat: scraper for monet arts
Signed-off-by: paprykdev <58005447+paprykdev@users.noreply.github.com>
2024-12-18 01:41:12 +01:00

14 lines
438 B
Python

import subprocess
def run_command(command: str, isPython: bool = False) -> str:
process = subprocess.run(
command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
return_massage = ""
if process.returncode != 0 and not isPython:
print(f"Error running command: {command}")
return_massage = process.stderr.decode()
return_massage = process.stdout.decode()
return return_massage