mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 00:04:15 +02:00
[commons.system] fix: some action errors not being displayed on the details component when they are concatenated with sudo output
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user