[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:
Vinicius Moreira
2022-03-25 15:50:01 -03:00
parent 8307864ed1
commit 330613f2c5
2 changed files with 6 additions and 2 deletions

View File

@@ -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)