Files
bearhub/fpakman/core/system.py
Vinícius Moreira f36991ea1f 0.2.0
**Features**
- Management panel shows update commands streams
- Management panel status label is "orange" now

**Fixes**
- Application name is not properly showing for Flatpak  1.2.X
2019-06-18 19:02:16 -03:00

12 lines
394 B
Python

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