IntelliJ WSL target invocation

Answered

Why does the IntelliJ WSL target call WSL with --exec?

The Terminal, intuitively, calls it without that flag which allows you to enjoy the normal comforts of your default shell profiles.

The only way I've found to e.g. modify the unix PATH available to the IntelliJ WSL target is by an arcane regedit (Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\<UUID for your WSL installation>\defaultEnvironment).

What is the logic behind defining WSL targets with --exec? Even though it's a noninteractive usage, the default wsl.exe invocation is just fine for that from what I can tell.

0
3 comments

Even though it's a noninteractive usage

Disabling shell for WSL prevents unexpected behavior of the IDE in case of shell profile customizations. 

What is the scenario of target path usage with shell env? May you elaborate on that? 

0

Here is why I need to have IDEA execute in a shell env.

I want to run a selenium test in a project that lives in wsl. I have installed google chrome and chromedriver in wsl. Because I am stuck on Windows 10 I have an X server running in Windows and need to set the DISPLAY environment variable in wsl to point to the Windows host ip.

I have done that in .zshenv (zsh is configured as default in wsl):

export DISPLAY=$(host `hostname --long` | grep -oP '(\s)\d+(\.\d+){3}' | tail -1 | awk '{ print $NF }' | tr -d '\r'):0.0

(the version using /etc/resolv.conf did not work for me when working via vpn).

Trying to start the selenium (geb, actually) test from IDEA gives meaningless error messages.

Took me quite some time while I tried a lot of other thing, but finally, I tried adding the DISPLAY variable to the run configuration and voila, it worked.

Problem is my IP keeps changing, so I would have to update the run config manually again and again.

0

Please sign in to leave a comment.