Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xonsh hangs when running carapace _carapace #1013

Open
2 of 11 tasks
bestlem opened this issue Apr 26, 2024 · 6 comments
Open
2 of 11 tasks

xonsh hangs when running carapace _carapace #1013

bestlem opened this issue Apr 26, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@bestlem
Copy link

bestlem commented Apr 26, 2024

Current Behavior

Any command beginning carapace _carapace hangs - xonsh is taking up 180% CPU

Expected Behavior

I assume just runs to an end

Steps To Reproduce

Just run carapace _carapace xonsh or replace xonsh by any other file name.

Version

1.0.1

OS

  • Linux
  • OSX
  • Windows

Shell

  • Bash
  • Elvish
  • Fish
  • Nushell
  • Oil
  • Powershell
  • Xonsh
  • Zsh

Anything else?

The command does run in fish

It is also unclear what should be set in xonsh.

the test

# prevent banner by creating a fake .xonshrc
sets no environment.

https://github.com/carapace-sh/carapace-bin says

# xonsh (~/.config/xonsh/rc.xsh)
COMPLETIONS_CONFIRM=True
exec($(carapace _carapace))

But the first line is not setting an environment variable so I think makes no effect. (It needs a $ to begin with)
Also the command show elsewhere is carapace _carapace xonsh (or any other shell name)

This documentation issue means that I am uncertain how to start carapace.

@bestlem bestlem added the bug Something isn't working label Apr 26, 2024
@rsteube
Copy link
Member

rsteube commented Apr 26, 2024

Cannot reproduce this issue so I need a bit more information.
Maybe logs give some insight? https://carapace-sh.github.io/carapace-bin/setup/environment.html#carapace_log

$CARAPACE_LOG=1
exec($(carapace _carapace))

@bestlem
Copy link
Author

bestlem commented Apr 26, 2024

Tried logging but there is nothing in /tmp and in $TMPDIR/carapace just a zero byte file.

Even carapace --help hangs (but only sometimes)

However doing an xonsh --no-rc and then calling carapace in another shell works.

It seems only to happen when xonsh is called directly from iTerm or terminal. Even in that case if I then run zsh from that shell and then xonsh it works.

ie steps to reproduce
Open Terminal.app
Choose Run Command
In that do xonsh --no-rc
Then run /carapace _carapace

I have tries with xonsh from macports (both 0.15.1 and 0.16.0) and nix but carapace only in nix as it is not in macports

@rsteube
Copy link
Member

rsteube commented May 1, 2024

So I tried the macports version of xonsh but still no luck.
Only issue I can see so far is that the shell detection doesn't work since neither in brew or macports the parent process is named xonsh (just Python).

@bestlem
Copy link
Author

bestlem commented May 1, 2024

I don't think the issue is which version of xonsh is used. I got the issue with both macports and nix, and different versions.

The difference seems to be is xonsh launched from another shell or not.

Did you run from Terminal.app without going through another shell? Unfortunately I don't think this is testable automatically as most test environments set up a shell.

I would note that carapace _carapace fish (or bash or zsh or rubbish) also hangs for me under a bare xonsh so it might not be the shell detection. Looking at https://github.com/carapace-sh/carapace/blob/master/internal/shell/shell.go I think that if I do pass in a shell name then the shell detection should not be called. They all work if I call xonsh from another shell first. (carapace _carapace rubbish gives the list of supported shells)

From xonsh the current process name is python3.11 in nix. This is true if run from inside another shell.

@EricDepagne
Copy link

I had the same issue. I use xonsh within tmux. And the faulty part of my configuration was this line, in my xonshrc file:
# $SHELL = $(which xonsh) # so tmux will stop loading bash
Once commented out, xonsh started fine and carapace did not gulp all my CPU.

@bestlem
Copy link
Author

bestlem commented Sep 29, 2024

I suspect xonsh/xonsh#5244 might be a related issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants