[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

@@ -31,6 +31,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- UI: - UI:
- fix: rare crash when updating table items - 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 ## [0.10.0] 2022-03-14

View File

@@ -1,4 +1,5 @@
import os import os
import re
import subprocess import subprocess
import sys import sys
import time import time
@@ -22,6 +23,8 @@ if GLOBAL_PY_LIBS not in PATH:
USE_GLOBAL_INTERPRETER = bool(os.getenv('VIRTUAL_ENV')) 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: def gen_env(global_interpreter: bool, lang: Optional[str] = DEFAULT_LANG, extra_paths: Optional[Set[str]] = None) -> dict:
custom_env = dict(os.environ) custom_env = dict(os.environ)
@@ -198,8 +201,8 @@ class ProcessHandler:
except UnicodeDecodeError: except UnicodeDecodeError:
continue continue
if line.startswith('[sudo] password'): if line.startswith('[sudo]'):
continue line = RE_SUDO_OUTPUT.split(line)[1]
output.write(line) output.write(line)