[arch] improvement -> AUR: upgrade checking now considers modification dates as well

This commit is contained in:
Vinicius Moreira
2020-12-17 18:35:34 -03:00
parent 4540fc938e
commit cf17a91b83
32 changed files with 432 additions and 149 deletions

View File

@@ -4,7 +4,7 @@ import sys
import time
from io import StringIO
from subprocess import PIPE
from typing import List, Tuple, Set, Dict
from typing import List, Tuple, Set, Dict, Optional
# default environment variables for subprocesses.
from bauh.api.abstract.handler import ProcessWatcher
@@ -322,6 +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) -> Tuple[int, str]:
p = subprocess.run(args=cmd.split(' ') if not shell else [cmd], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=shell)
def execute(cmd: str, shell: bool = False, cwd: Optional[str] = None) -> Tuple[int, str]:
p = subprocess.run(args=cmd.split(' ') if not shell else [cmd],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=shell,
cwd=cwd)
return p.returncode, p.stdout.decode()