mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 22:54:16 +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:
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user