[arch] improvement -> history/downgrade considering the repository commit + bug fixes

This commit is contained in:
Vinicius Moreira
2020-12-21 12:25:54 -03:00
parent dac56591ec
commit 7057f683cd
19 changed files with 230 additions and 160 deletions

View File

@@ -322,11 +322,11 @@ def check_enabled_services(*names: str) -> Dict[str, bool]:
return {s: status[i].strip().lower() == 'enabled' for i, s in enumerate(names) if s}
def execute(cmd: str, shell: bool = False, cwd: Optional[str] = None) -> Tuple[int, str]:
def execute(cmd: str, shell: bool = False, cwd: Optional[str] = None, output: bool = True) -> Tuple[int, Optional[str]]:
p = subprocess.run(args=cmd.split(' ') if not shell else [cmd],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
stdout=subprocess.PIPE if output else subprocess.DEVNULL,
stderr=subprocess.STDOUT if output else subprocess.DEVNULL,
shell=shell,
cwd=cwd)
return p.returncode, p.stdout.decode()
return p.returncode, p.stdout.decode() if p.stdout else None