Home > Blockchain >  wsl.exe always appears multiple times in eclipse local terminal custom entries
wsl.exe always appears multiple times in eclipse local terminal custom entries

Time:05-29

Using eclipse 2021-06 on a windows 10 PC, when I open a local terminal, it always displays multiple rows for the wsl.exe terminal, with names like this...

enter image description here

Even when I go to the eclipse Window -> Preferences -> Terminal -> Local Terminal settings and delete these custom entries, they still continue to appear in the list.

How can I permanently delete these local terminal entries from eclipse?

CodePudding user response:

Short answer:

Upgrading to the latest Eclipse release should fix the issue.

More detail:

I'm going to take an educated guess here without (apologies) attempting to reproduce it myself. As @howlger mentioned in the comments, the 2021-06 release is a bit outdated.

When it was released, there were essentially two states for WSL:

  • If the WSL feature was not enabled in Windows, then there was no wsl.exe binary on the system.
  • When the WSL feature was enabled, the wsl.exe command became available.

So Eclipse is likely checking for the existing of wsl.exe and running the wsl -l -q command to get a list of distributions.

However, in both the Windows 21H2 release and Windows 11, the WSL behavior has changed. wsl.exe always exists, but operates in two states:

  • When WSL is not enabled, wsl.exe is simply a tool that enables/installs it (via wsl --install). If executed with any other arguments (like wsl -l -q, as Eclipse probably is), then it returns the help. This is what you are seeing - Eclipse is erroneously parsing the help output and believing that it is a list of distributions.
  • When WSL is enabled, wsl.exe becomes the actually CLI interface to WSL.

As @howlger also points out in the comments to this answer, the issue was known and has been fixed.

If for some strange reason you can't upgrade, you can almost certainly stop the problem from occurring by enabling WSL in Turn Windows Features On or Off. If you don't install any distributions, then wsl -l -q should return an empty list for Eclipse.

If upgrading to the latest Eclipse doesn't work, which I think would be unlikely, then you may be facing a different issue that you might need to report to the Eclipse team.

  • Related