-
-
Notifications
You must be signed in to change notification settings - Fork 50
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 setting Windows hosts within WSL #45
Comments
I'm also using wsl2, and I was thinking the same thing. |
Calling out to a shell will be necessary to resolve the path here. To do so reliably in any case (there can be some funky Windows setups out there). wslpath -u $(cmd.exe /c echo "%WINDIR%/System32/drivers/etc/hosts")
# /mnt/c/WINDOWS/System32/drivers/etc/hosts Interestingly |
I did my own version since it seems this project is abandoned. |
Host files don't change much over the course of 2 years. I'd go as far to say that they don't change much over the course of a decade. More a case of low attention and prioritisation then abandonment. @feross (if you happen to see this), would you be open to accepting a PR with the functionality described here? Happy to add this to my project pile if so. |
@feross I hope you respond, we are sitting ducks right now trying to modify your code. could implemented is-wsl from npmjs and go from there, this module verifies if your using wsl and docker. |
@benlumia007 I can probably merge any code changes if needed, but I cannot really judge what the expected interfaces are on Windows - (I only test but don't really develop on that platform, wouldn't even have expected them to have two different 'hosts' files. I only know about the one in system32/drivers/...) Would a solution for WSL2 also apply to WSL? You said you already have your own solution, is that in a fork somewhere or not based on hostile code ? |
Since I am uisng WSL2 and ubuntu, I had to take out the scripts and put it into my project, What I did was i had to add a module called is-wsl, then, replace WINDOWS = isWSL
this means that only wsl works, but if you're in win32 won't work. so the if statements may be need a fix. |
is-wsl also checks if is docker included, |
Sure, I'm happy to review a PR that adds support for Windows. |
Provided an elevated shell session is used, it is possible to modify the Windows
hosts
file within WSL (Windows Subsystem for Linux). It would be useful if hostile supported working with Windows hosts within WSL.An example of adding hosts;
With standard host drive mount configuration,
wslpath -u -a C:\\Windows\\System32\\drivers\\etc\\hosts
returns/mnt/c/Windows/System32/drivers/etc/hosts
. The resolved path should be treated as case sensitive.Thoughts?
The text was updated successfully, but these errors were encountered: