2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2025-01-13 18:33:15 +00:00
frappe_docker/build/common/commands/utils.py

15 lines
480 B
Python
Raw Normal View History

import subprocess
def run_command(command, stdout=None, stderr=None):
stdout = stdout or subprocess.PIPE
stderr = stderr or subprocess.PIPE
process = subprocess.Popen(command, stdout=stdout, stderr=stderr)
out, error = process.communicate()
if process.returncode:
print("Something went wrong:")
print(f"return code: {process.returncode}")
print(f"stdout:\n{out}")
print(f"\nstderr:\n{error}")
exit(process.returncode)