Files
bearhub/core/system.py
Vinicius Moreira d5142662eb Installer script
2019-06-13 14:56:03 -03:00

7 lines
272 B
Python

import subprocess
def run_cmd(cmd: str, expected_code: int = 0, ignore_return_code: bool = False) -> str:
res = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE)
return res.stdout.decode() if ignore_return_code or res.returncode == expected_code else None