[arch] fix -> uninstall: not detecting hard requirements properly

This commit is contained in:
Vinicius Moreira
2020-09-11 11:17:27 -03:00
parent 590eb2abd2
commit 293d2a5fb0
15 changed files with 235 additions and 86 deletions

View File

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