mirror of
https://github.com/clearml/clearml
synced 2025-02-01 17:43:43 +00:00
13 lines
392 B
Python
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()
|