Intellij, WSL, and Fish shell

已回答

I am running Intellij on my Windows machine using WSL integration. On WSL, I use normally load Fish shell by default because it is my shell of choice. However, this causes Intellij to hang with the message: "Cannot resolve $HOME variable on WSL. Looks like the WSL integration process is hanging. Try to restart WSL or the host machine."

If I do not load fish by default in my .bashrc, then Intellij works fine.

Is there a way to make Intellij, WSL, and Fish play nicely together?

0

Do you run IntelliJ IDEA inside WSL? Please clarify your workflow. At what stage do you see this error? Can you share a screenshot?

1

I run IntelliJ on my host but loading a WSL-based project. IntelliJ loads up but the build pane opens and displays the error. It is very sluggish. As I said, if I disable fish on startup then I can restart the build with the circular arrows and IntelliJ is happy again.

0

It looks like https://youtrack.jetbrains.com/issue/IDEA-287063/Unable-to-sync-maven-project-that-located-in-WSL.

One of the users reported that https://stackoverflow.com/a/63207006/104891 helps.

Your case may be different, but if there is something waiting for input when WSL integration is invoked (like some shell script), it will affect the integration. You need to find what exactly is waiting for user input in your WSL environment and remove it.

1

For completeness, here is the fish start in my bash .profile. I have a conditional startup (so I can drop back to bash when needed). I don't think that is relevant, but here it is just in case.

0

Thanks Serge, I found that before I posted. I am not loading SSH in my fish config (since my bash config works). I don't see anything else that requires input. :/ I just commented out everything in my fish startup config and it still does not load.

0

Does this command work for you (adjust the distribution name)?

C:\Windows\system32\wsl.exe --distribution Ubuntu --exec /bin/sh -i -l -c env

You need to find out why "/bin/sh -i -l -c env" is freezing in your setup.

1

I modified it for my distribution (Ubuntu-20.04), but it does seem to work:

PS C:\Users\me> C:\Windows\system32\wsl.exe --distribution Ubuntu-20.04 --exec /bin/sh -i -l -c env
me@Ubuntu /m/c/U/me> <this is fish>
0

This command should print the environment and exit instead of displaying any prompts and expecting any input.

1

it must be waiting for fish to exit

0

Starting fish without passing any options and replacing the default shell on any command invocation is asking for problems.

1

It is convenient to not have to change your shell every time you open a terminal, but I do understand and appreciate your point. Is there a way to configure/modify the command IntelliJ is using to start the shell? For example, can I add an environment variable or some such thing?

0

No, this command is hardcoded, modify your profile script instead to not start fish if there are any options passed.

UPDATE: IDE uses $SHELL environment, so you can replace the default shell in WSL instead, but you cannot change the command itself.

2

Ok, I just changed my default shell to fish using chsh -s. In retrospect, this is the way I should have done it in the first place. I then removed the bash starting fish stuff and now everything is working as expected.

I think there could be use cases where the user might need/want to modify the script being fired off by IntelliJ, but this is not necessary in my case.

I appreciate the help!

0

请先登录再写评论。