clearml/trains/backend_interface/task/repo/util.py
2019-06-10 20:02:11 +03:00

13 lines
392 B
Python

import os
from subprocess import check_output
def get_command_output(command, path=None):
"""
Run a command and return its output
:raises CalledProcessError: when command execution fails
:raises UnicodeDecodeError: when output decoding fails
"""
with open(os.devnull, "wb") as devnull:
return check_output(command, cwd=path, stderr=devnull).decode().strip()