[flatpak] fix -> some environment variables are not available during the common operations

This commit is contained in:
Vinicius Moreira
2020-08-20 12:37:21 -03:00
parent 4544a46421
commit b99462d0e5
4 changed files with 35 additions and 32 deletions

View File

@@ -66,7 +66,8 @@ class SimpleProcess:
def __init__(self, cmd: List[str], cwd: str = '.', expected_code: int = 0,
global_interpreter: bool = USE_GLOBAL_INTERPRETER, lang: str = DEFAULT_LANG, root_password: str = None,
extra_paths: Set[str] = None, error_phrases: Set[str] = None, wrong_error_phrases: Set[str] = None,
shell: bool = False):
shell: bool = False,
success_phrases: Set[str] = None):
pwdin, final_cmd = None, []
self.shell = shell
@@ -80,6 +81,7 @@ class SimpleProcess:
self.expected_code = expected_code
self.error_phrases = error_phrases
self.wrong_error_phrases = wrong_error_phrases
self.success_phrases = success_phrases
def _new(self, cmd: List[str], cwd: str, global_interpreter: bool, lang: str, stdin = None, extra_paths: Set[str] = None) -> subprocess.Popen:
@@ -186,6 +188,12 @@ class ProcessHandler:
success = proc.instance.returncode == proc.expected_code
string_output = output.read()
if proc.success_phrases:
for phrase in proc.success_phrases:
if phrase in string_output:
success = True
break
if not success and proc.wrong_error_phrases:
for phrase in proc.wrong_error_phrases:
if phrase in string_output: