feat(shell): support for Fish on Windows#4775
feat(shell): support for Fish on Windows#4775fstanis wants to merge 1 commit intoprefix-dev:mainfrom
Conversation
1e12192 to
6ea8390
Compare
d62d61b to
57c0946
Compare
| command.arg("--init-file"); | ||
| command.arg(&temp_path); | ||
| command.arg(&init_file_path); | ||
| command.arg("-i"); |
There was a problem hiding this comment.
I wonder if you could leave the bash --init-file logic the same as before, and switch this -i into -c fish -i when the shell is fish?
There was a problem hiding this comment.
I tried that initially and, unfortunately, it didn't work. While fish inherits the environment variables from the parent bash, it can't inherit the functions (i.e. prompt and completions) because those are shell-specific. So either that would start fish without the prompt or shell completion (if we always use those for bash regardless of shell) or would fail completely (because fish function syntax is incompatible with bash).
There was a problem hiding this comment.
Thinking about it, we could probably just skip completions and prompt for zsh for now (or for fish as well, if we want to make this code simpler) and possibly tell the user how to add these manually by editing their .zshrc / config.fish.
|
Hey @ruben-arts / @baszalmstra, just a friendly ping since it's been a few weeks, would appreciate your input if you're happy we proceed with this approach |
|
Im trying to test your changes but Im having a hard time installing |
|
Sure - you need to install After that, |
7a20c54 to
41f33d0
Compare
41f33d0 to
fe11892
Compare
|
friendly ping |
|
@baszalmstra could you take a look? |
This PR fixes #4648.
Currently, on Windows (via #3981) we launch bash by creating a new bash process with
--init-filewhich contains all the environment variables, completions and custom prompt.This doesn't work for other shells unfortunately since
--init-fileis bash-specific. This PR splits the init file into two parts: one for the environment variables (calledinit_filein code), which uses bash syntax, and the other one for completions and custom prompt, which is specific to the shell that's starting (calledenv_filein code).pixi shelltherefore first startsbashin a new process with theinit_file, then one of two things happens:execfor fish to "take over" the bash process, sourcingenv_filein the process.sourcethe file withenv_file.This logic should be possible to reuse for
xonshandzshas well, although someone more knowledgeable would need to clarify how to best perform the "take over" step for those shells.