Support `gdk open` on Windows Subsystem for Linux
What does this merge request do and why?
Initial attempt to get gdk open
to work on WSL. This is a first pass, happy to receive feedback. It calls Machine.wsl?
the first call now which is slightly "intensive", but since it's cached I'm assuming it's OK. This sacrifice might be too expensive to support an advanced configuration.
References:
How to determine if WSL?
caveat: pwsh.exe only is for PowerShell version 7 and above.
Most windows installations currently use PowerShell (powershell.exe version 5) by default, but in the future this will be more reliable. In the present this might not be very helpful.
(they can be installed alongside eachother)
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Be on Windows
gdk start
gdk open
On the main branch, this would yield:
[zarthus@windows ~/Dev/gitlab-development-kit] main ✔ $ gdk start
...
[zarthus@windows ~/Dev/gitlab-development-kit] main ✔ $ gdk open
sh: 1: xdg-open: not found
[zarthus@windows ~/Dev/gitlab-development-kit] main ✔ $ echo $?
127
On this feature branch, this would yield:
[zarthus@windows ~/Dev/gitlab-development-kit] jah/support-gdk-open-on-wsl ✔ $ gdk start
...
[zarthus@windows ~/Dev/gitlab-development-kit] jah/support-gdk-open-on-wsl ✔ $ gdk open
[zarthus@windows ~/Dev/gitlab-development-kit] jah/support-gdk-open-on-wsl ✔ $ echo $?
0
before | after |
---|---|
Alternative implementation:
https://github.com/cpbotha/xdg-open-wsl or adding some small script like
/usr/bin/xdg-open
pwsh.exe -Command Start-Process $@
Might work too.
We could add this to documentation.
Impacted categories
The following categories relate to this merge request:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
Merge request checklist
-
This change is backward compatible. If not, please include steps to communicate to our users. -
Tests added for new functionality. If not, please raise an issue to follow-up. -
Documentation added/updated, if needed. -
Announcement added, if change is notable. -
gdk doctor
test added, if needed. -
Add the ~highlight
label if this MR should be included in theCHANGELOG.md
.