Skip to content

Commit

Permalink
asd
Browse files Browse the repository at this point in the history
  • Loading branch information
mjurbanski-reef committed Mar 27, 2024
1 parent c8d73a4 commit bfb0147
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions b2/_internal/_cli/autocomplete_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def get_script_path(self) -> Path:
return Path("~/.zsh/completion/").expanduser() / f"_{self.prog}"

def is_enabled(self) -> bool:
is_terminal = os.isatty(0)
is_terminal = os.isatty(0) or True
# `is_terminal=False` means most of the time we are under `pytest-xdist` and running `zsh -i` would hang
cmd = [self.shell_exec, '-i', '-c', f'[[ -v _comps[{quote(self.prog)}] ]]']
return _silent_success_run(cmd) if is_terminal else _silent_success_run(_tty_cmd_wrap(cmd))
Expand Down Expand Up @@ -197,7 +197,11 @@ def is_enabled(self) -> bool:

def _silent_success_run(cmd: List[str]) -> bool:
p = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.DEVNULL
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.DEVNULL,
start_new_session=True, # `zsh -i` can hang tests without this
)
stdout, stderr = p.communicate()
if p.returncode != 0:
Expand Down

0 comments on commit bfb0147

Please sign in to comment.