mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 12:04:15 +02:00
fix: conflict output in stderr
This commit is contained in:
@@ -58,15 +58,34 @@ class SystemProcess:
|
|||||||
|
|
||||||
class SimpleProcess:
|
class SimpleProcess:
|
||||||
|
|
||||||
def __init__(self, cmd: List[str], cwd: str = '.', expected_code: int = None, global_interpreter: bool = USE_GLOBAL_INTERPRETER, lang: str = DEFAULT_LANG):
|
def __init__(self, cmd: List[str], cwd: str = '.', expected_code: int = None, global_interpreter: bool = USE_GLOBAL_INTERPRETER,
|
||||||
self.instance = subprocess.Popen(cmd,
|
lang: str = DEFAULT_LANG, root_password: str = None):
|
||||||
stdout=subprocess.PIPE,
|
pwdin, final_cmd = None, []
|
||||||
stderr=subprocess.STDOUT,
|
|
||||||
bufsize=-1,
|
if root_password is not None:
|
||||||
cwd=cwd,
|
final_cmd.extend(['sudo', '-S'])
|
||||||
env=gen_env(global_interpreter, lang))
|
pwdin = self._new(['echo', root_password], cwd, global_interpreter, lang).stdout
|
||||||
|
|
||||||
|
final_cmd.extend(cmd)
|
||||||
|
|
||||||
|
self.instance = self._new(final_cmd, cwd, global_interpreter, lang, stdin=pwdin)
|
||||||
self.expected_code = expected_code
|
self.expected_code = expected_code
|
||||||
|
|
||||||
|
def _new(self, cmd: List[str], cwd: str, global_interpreter: bool, lang: str, stdin = None) -> subprocess.Popen:
|
||||||
|
|
||||||
|
args = {
|
||||||
|
"stdout": subprocess.PIPE,
|
||||||
|
"stderr": subprocess.STDOUT,
|
||||||
|
"bufsize": -1,
|
||||||
|
"cwd": cwd,
|
||||||
|
"env": gen_env(global_interpreter, lang)
|
||||||
|
}
|
||||||
|
|
||||||
|
if stdin:
|
||||||
|
args['stdin'] = stdin
|
||||||
|
|
||||||
|
return subprocess.Popen(cmd, **args)
|
||||||
|
|
||||||
|
|
||||||
class ProcessHandler:
|
class ProcessHandler:
|
||||||
|
|
||||||
|
|||||||
@@ -501,9 +501,8 @@ class ArchManager(SoftwareManager):
|
|||||||
|
|
||||||
handler.watcher.change_substatus(self.i18n['arch.checking.conflicts'].format(bold(pkgname)))
|
handler.watcher.change_substatus(self.i18n['arch.checking.conflicts'].format(bold(pkgname)))
|
||||||
|
|
||||||
for check_out in new_root_subprocess(['pacman', '-U', pkgpath], root_password=root_password, cwd=pkgdir).stdout:
|
for check_out in SimpleProcess(['pacman', '-U', pkgpath], root_password=root_password, cwd=pkgdir).instance.stdout:
|
||||||
if check_out:
|
check_install_output.append(check_out.decode())
|
||||||
check_install_output.append(check_out.decode())
|
|
||||||
|
|
||||||
self._update_progress(handler.watcher, 70, change_progress)
|
self._update_progress(handler.watcher, 70, change_progress)
|
||||||
if check_install_output and 'conflict' in check_install_output[-1]:
|
if check_install_output and 'conflict' in check_install_output[-1]:
|
||||||
|
|||||||
Reference in New Issue
Block a user