2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-11-10 23:30:56 +00:00
frappe_docker/build/common/commands/utils.py
Chinmay D. Pai 1d9dd966b1
fix: pipe uncompressed database to file
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
2020-07-10 10:07:22 +05:30

15 lines
480 B
Python

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)