Skip to content

fix(cli): wait for a Windows opener's exit code on WSL, and keep unsafe paths from wslview - #75

Merged
hyamero merged 1 commit into
stagingfrom
fix/wsl-open-fallback
Nov 14, 2026
Merged

hyamero merged 1 commit into
stagingfrom
fix/wsl-open-fallback

Conversation

@hyamero

@hyamero hyamero commented Nov 14, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #73, from a review of the WSL opener chain.

 on WSL, deliver --open tries in order
-  wslview <path>                      still running after 3s counts as opened
-  powershell.exe -EncodedCommand …    still running after 3s counts as opened
-    or /mnt/c/Windows/…/powershell.exe when it is off the PATH
+  wslview <path>                      only for paths without $ ` or quotes; waits up to 15s for an exit code
+  powershell.exe -EncodedCommand …    waits up to 15s for an exit code
+    or wherever `wslpath -u C:\Windows\…\powershell.exe` puts it, then /mnt/c as before
   xdg-open <path>                     still running after 3s counts as opened
  • Longer wait for the Windows side. PowerShell started through WSL interop can take more than 3 seconds to load. If it then failed, the chain had already reported success, so no warning was printed and xdg-open was never tried. xdg-open keeps the short wait because it can become the browser and never exit.
  • Unsafe paths skip wslview. wslview hands the path to PowerShell with its own quoting, so a path with $, a backtick or a quote goes straight to the encoded-command opener, which escapes it. I could not reach the wslview source to confirm how it quotes, so this is a guard, not a fix for a reproduced bug.
  • PowerShell off the PATH is now found under a moved automount root ([automount] root=/), not only at /mnt/c.
  • Tests: the PowerShell opener's shape is asserted again, and the two POSIX-only tests skip on a Windows host.

Not changed: explorer.exe is not restored as a fallback (its exit code cannot say whether anything opened), and xdg-open stays last.

Evidence

  • Before: an opener that exits 1 after one second is reported as opened once 100 ms have passed, and nothing can ask for longer.
    After: waits as long as the opener asks before taking it as handed off passes: with wait: 100 it counts as handed off, with wait: 30000 it reports exited with 1.
bun run --filter @omsimos/stackmap test        64 passed
bun run --filter @omsimos/stackmap typecheck   pass

Run on macOS only. Nothing here was run on WSL.

Merge Danger

Door: two-way

One commit touching packages/cli/src/open.ts and its test.

Blast Radius: Narrow

Only deliver --open on WSL. If a Windows opener hangs without exiting, the command now waits up to 15 seconds, where it waited 3, before treating the file as opened.

…owerShell would expand from wslview, and find PowerShell under any automount root
@vercel

vercel Bot commented Nov 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
stackmap-site Skipped Skipped Nov 14, 2026 4:53am UTC

@hyamero
hyamero merged commit a13b824 into staging Nov 14, 2026
8 checks passed
@hyamero
hyamero deleted the fix/wsl-open-fallback branch November 14, 2026 05:13
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.6.3-rc.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.6.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

This branch was previously deployed

1 inactive deployment
Preview — ab136290 Deployed Nov 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant