Support /mnt/ and \\wsl.localhost\ and \\wsl$\ style links on Windows frontends#169592
Support /mnt/ and \\wsl.localhost\ and \\wsl$\ style links on Windows frontends#169592
Conversation
|
@aeschli a review would be appreciated since you're fairly familiar with WSL |
|
Here's the code I use in the WSL extension.
|
| return null; | ||
| // If the link looks like a /mnt/ WSL path and this is a Windows frontend, use the backend | ||
| // to get the resolved path from the wslpath util. | ||
| if (isWindows && link.match(/^\/mnt\/[a-z]/i) && this._processManager.backend) { |
There was a problem hiding this comment.
Potentially all links that start or contain / can be paths from the WSL subsystem.
/home/me/test.txt -> \\wsl$\Ubuntu\home\me\test.txt
There was a problem hiding this comment.
I think this sort of thing would have to be a separate feature request. It should just work out of the box in a remote wsl workspace or if you have the local wsl folder open, but to reliably know what distro to do we would want to have more knowledge about what's actually running in the terminal. That's possible but out of the scope of this change imo.
There was a problem hiding this comment.
ok, understand that you don't know the distro, especially in a local window, when the user uses wsl.exe himself. And just looking for /mnt/ and calling wsl.exe of the default distro will probably work, but just to say, distros can change the windows root from /mnt/ to something else
In a remote WSL window all that should not really be necessary. The link can be detected as a linux path /mnt/... and opened as such (ill open and editor on '/mnt/...`)
|
Your changes look ok, I just put the |
|
|
|
Although we may not need to worry about injection when using execFile vs exec 🤔, I hesitant as I don't want to introduce a security issue is all |
|
execFile is safer. But it's important to run it with a full absolute path. Just invoking |
Fixes #148062