diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b20e84c..20268134 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - UI: - fix: rare crash when updating table items + - some action errors not being displayed on the details component when they are concatenated with sudo output ## [0.10.0] 2022-03-14 diff --git a/bauh/commons/system.py b/bauh/commons/system.py index 6be7f1eb..83678455 100644 --- a/bauh/commons/system.py +++ b/bauh/commons/system.py @@ -1,4 +1,5 @@ import os +import re import subprocess import sys import time @@ -22,6 +23,8 @@ if GLOBAL_PY_LIBS not in PATH: USE_GLOBAL_INTERPRETER = bool(os.getenv('VIRTUAL_ENV')) +RE_SUDO_OUTPUT = re.compile(r'[sudo]\s*[\w\s]+:\s*') + def gen_env(global_interpreter: bool, lang: Optional[str] = DEFAULT_LANG, extra_paths: Optional[Set[str]] = None) -> dict: custom_env = dict(os.environ) @@ -198,8 +201,8 @@ class ProcessHandler: except UnicodeDecodeError: continue - if line.startswith('[sudo] password'): - continue + if line.startswith('[sudo]'): + line = RE_SUDO_OUTPUT.split(line)[1] output.write(line)