Management panel shows update commands streams

This commit is contained in:
Vinicius Moreira
2019-06-18 17:01:13 -03:00
parent 833f7c142e
commit 3ffe2ad96f
9 changed files with 92 additions and 45 deletions

View File

@@ -1,6 +1,11 @@
import subprocess
from typing import List
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
def stream_cmd(cmd: List[str]):
return subprocess.Popen(cmd, stdout=subprocess.PIPE).stdout