Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for WSL: Spaces in cmd path, translate pathname from WSL2 to Windows #143

Closed
bmo opened this issue May 8, 2021 · 6 comments · Fixed by #154
Closed

Support for WSL: Spaces in cmd path, translate pathname from WSL2 to Windows #143

bmo opened this issue May 8, 2021 · 6 comments · Fixed by #154

Comments

@bmo
Copy link

bmo commented May 8, 2021

Would be great to be able to use this when running Ubuntu on Windows using WSL.

When run using the Windows Subsystem for Linux, the default browser may actually be a Windows app, like chrome. The file://// argument may also need to be translated to the Windows pathname.

The path to the exe ($BROWSER) could have spaces in it, so it's probably good to pass it in quotes. An example of the real path to BROWSER on my machine is

/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe

(I believe it's possible for paths on osx to have spaces, too.)

wslpath -w command (exists on Linux distros running on WSL) translates file paths path from WSL to Windows, which is necessary if the BROWSER being invoked is a Windows application.

@bmo bmo changed the title Support for WSL: Spaces in cmd path, translate pathname from WSL to windows Support for WSL: Spaces in cmd path, translate pathname from WSL to Windows May 8, 2021
@rubyFeedback
Copy link

Can that work? E. g. to call from within WSL?

I am thinking a bit about WSL1 too. I have not much experience with WSL2 but I suppose it should be possible; I did not try that on windows. Does the above work on windows? I mean the /mnt/ path. (I suppose it should work but I don't know if you can spawn external commands that way on both WSL1 WSL2; if it is just meant for WSL2 then perhaps the title should be changed.)

@bmo bmo changed the title Support for WSL: Spaces in cmd path, translate pathname from WSL to Windows Support for WSL: Spaces in cmd path, translate pathname from WSL2 to Windows Feb 10, 2022
@bmo
Copy link
Author

bmo commented Feb 10, 2022

yes, I use this on one of my development machines all of the time, for example to have Letter Opener gem start a web browser to display an email message.

@bmo
Copy link
Author

bmo commented Feb 10, 2022

I haven't put it into a PR (haven't written the tests), however this gets used every day for me:

bmo@8c3eab8

@copiousfreetime
Copy link
Owner

@snuggs - take look

@snuggs
Copy link

snuggs commented Apr 17, 2022

@copiousfreetime now have a windows system. Will install WSL and update when finished doing a touch of (personal) research. @bmo @rubyFeedback this is my first time with WSL installed. (And haven't used Windows in a few years). Is there any value in installing WSL 1, then upgrading to 2? Or at this date just go for v2?

Thanks in advance for your patience.

@bmo
Copy link
Author

bmo commented Apr 18, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants