craftcms / nitro

Speedy local dev environment for @craftcms.
https://getnitro.sh
MIT License
178 stars 24 forks source link

Windows hosts file editing steps missing for `create` and `add` commands #279

Closed mattstein closed 3 years ago

mattstein commented 3 years ago

Description

These really good docs promise Nitro will output steps for manually editing etc\hosts in Windows:

Nitro commands that want to edit that file will give you the steps so you can manually perform the edit.

This is true only for the apply command, but not when running create or add. I would expect that Nitro would output these steps any time hostnames need to be updated, regardless of the command used.

Steps to reproduce

  1. Install Nitro for Windows.
  2. Use nitro create, follow the prompts, and note the steps end with the following output:
    Adding sites to hosts file…
      … modifying hosts file ✓
  3. Use nitro edit to save a change to nitro.yaml, then run nitro apply.
  4. Observe the resulting output includes the promised instructions fenced with ---- COPY BELOW ---- and ---- COPY ABOVE ----.

Additional info

jasonmccallister commented 3 years ago

I’m pretty sure I know what this is and will look into it soon.

jamesmacwhite commented 3 years ago

Hopefully if possible and based on further investigation, the ambition in the future would be for Nitro to be able to commit the /etc/hosts content directly to the Windows system hosts file too, as the /mnt/c/ path is exposed through WSL, the only caveat is an elevated WSL terminal is needed to be able to do this, as even with sudo without the process being elevated to begin with from the Windows host, a file write is not possible from within WSL.

https://github.com/craftcms/nitro/issues/258