From 07cb2a719ff389c05ff3eda385739e43808fad38 Mon Sep 17 00:00:00 2001 From: Maciej Urbanski Date: Thu, 28 Mar 2024 11:21:54 +0100 Subject: [PATCH] more debug logging in exec --- b2/_internal/_cli/autocomplete_install.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/b2/_internal/_cli/autocomplete_install.py b/b2/_internal/_cli/autocomplete_install.py index 452137c3..06745bb4 100644 --- a/b2/_internal/_cli/autocomplete_install.py +++ b/b2/_internal/_cli/autocomplete_install.py @@ -178,6 +178,9 @@ def is_enabled(self) -> bool: "pexpect is recommended for Zsh shell autocomplete installation check without tty. " "You can install it via `pip install pexpect`." ) + _silent_success_run( + [self.shell_exec, '-c', 'autoload -Uz compinit; compinit; echo AUDIT; compaudit'] + ) cmd = [self.shell_exec, '-i', '-c', f'[[ -v _comps[{quote(self.prog)}] ]]'] return _silent_success_run(cmd) if emulate_tty else _silent_success_run_with_pty(cmd) @@ -258,9 +261,8 @@ def _silent_success_run_with_pty(cmd: list[str], timeout: int = 5, env: dict | N finally: child.close() - logger.debug( - "Command %r exited with code %r, output: %r", cmd, child.exitstatus, output.getvalue() - ) + (logger.debug if child.exitstatus == 0 else logger.warning + )("Command %r exited with code %r, output: %r", cmd, child.exitstatus, output.getvalue()) return child.exitstatus == 0