2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-11-13 00:36:26 +00:00
frappe_docker/build/common/commands/utils.py

15 lines
505 B
Python
Raw Normal View History

import subprocess
2020-07-10 10:48:25 +00:00
def run_command(command, stdout=None, stdin=None, stderr=None):
stdout = stdout or subprocess.PIPE
stderr = stderr or subprocess.PIPE
2020-07-10 10:48:25 +00:00
process = subprocess.Popen(command, stdout=stdout, stdin=stdin, 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)