Repository navigation
fix(cli): try the Windows browser first on WSL, and warn when it can't open - #73
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
|
🎉 This PR is included in version 0.6.2-rc.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Contributor
|
🎉 This PR is included in version 0.6.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #71, from a review of it. Refs #70.
Summary
The WSL fallback from #71 could still leave a user with no browser and no warning:
explorer.exeexits with 1 whether or not it opened the file, so its exit code was ignored. With broken interop (a staleWSL_INTEROPsocket, say) nothing opened and nothing was reported.xdg-openran first. Where it is installed but has no Linux browser, it can exit 0 having opened nothing, and that ended the chain before the Windows side was tried.The WSL chain is now:
-EncodedCommand, with the path single-quoted and every quote PowerShell recognises doubled.appendWindowsPath=false,powershell.exeisn't found by name, so it is retried at/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe. This assumes the default/mnt/cmount.wslpathreadswslpath not foundinstead of a conversion failure.Evidence
openWith is not a function).After:
open.test.tspasses, 13 of 13. The new tests spawn real child processes for the fallback loop, exit codes, a signal kill, the off-PATH retry and the encoded command. The CLI suite passes, 62 of 62, andbun run typecheckis clean.PATH:powershell.exe, exiting 0: success. It receivedStart-Process -FilePath '\\wsl.localhost\Ubuntu\home\u\it''s diagram.html'for/home/u/it's diagram.html.powershell.exeexiting 1:wslview not found; powershell.exe exited with 1; xdg-open not found. Before, this was a silent success.xdg-openexiting 0 andpowershell.exeboth present:powershell.exeruns andxdg-opendoesn't.wslviewpresent: it opens the file and nothing else runs.wslpathfailing with text on stderr:wslview not found; wslpath couldn't convert the path; xdg-open not found, and stderr stays empty.wslview not found; wslpath not found; xdg-open not found.Start-Processopens the browser on a\\wsl.localhost\…path and exits non-zero when it can't.Merge Danger
Door: two-way
Blast Radius: cli-open-on-wsl
Only
--openon WSL changes. Outside WSL, Linux still runsxdg-openalone, and darwin and win32 run the same commands as before.