Fixes issue where fnm print the node version string when using fish shell in non-interactive mode #958
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This week I ran into an issue with
Neovide
, a neovim gui (also written in rust).I proposed GH-955 but did not feel this was the right fix for this issue, so this PR replaces that.
Neovide starts neovim in a sub-shell and uses the neovim --embed mode to read and write msgpack messages to and from stdout.
When I start Neovide in a folder with a
.nvmrc
that defines a node version that is not my default,fnm
prints a message and that ends up in the communication between Neovide and nvim and makes it crash.Neovide runs a non-interactive shell, and in that mode your shell init scripts are not supposed to print anything. In that mode, the shell typically don't ready
.bashrc
and similar. However, for thefish
shell, it seems like it always reads config.fish (fish-shell/fish-shell#5394).This PR adds changes the behaviour of
fnm env --use-on-cd
for thefish
shell to add a conditional check whether the shell is interactive or not. Iffish
is in non-interactive modefnm use
is started with a new switch--silent
that will not letfnm
output the version string even if the version will change.