xonsh hangs when running carapace _carapace
Opened this issue · 4 comments
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
carapace/example/_test/invoke_xonsh
Line 7 in db7e596
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.
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))
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
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
).
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.