fix(wasm): driver discovery on Windows hosts#399
Open
zeroshade wants to merge 1 commit into
Open
Conversation
Under GOOS=js on Windows, os.ReadDir and os.DirFS fail because Go's js/wasm syscall layer rejects O_DIRECTORY (Node.js doesn't expose fs.constants.O_DIRECTORY on Windows). This caused listInstalled to always return empty on Windows hosts. Split loadDir into build-tagged files: the js variant uses os.Open (no O_DIRECTORY) + File.ReadDir which works on all hosts. Re-enable windows-latest in the WASM CI workflow. Closes #396 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
amoeba
approved these changes
Jul 13, 2026
amoeba
left a comment
Member
There was a problem hiding this comment.
This seems fine. The two variants share enough code that we could extract just the platform-variable part but this is simple and it works.
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.
Summary
listInstalledreturning empty on Windows hosts when running via WASM. The root cause is Go's js/wasmsyscall.OpenrejectingO_DIRECTORY(Node.js doesn't exposefs.constants.O_DIRECTORYon Windows), which breaksos.ReadDir/os.DirFS/fs.Glob.loadDirinto build-tagged files:loaddir_js.gousesos.Open+File.ReadDir(avoidsO_DIRECTORY);loaddir_other.gokeeps the originalos.DirFS+fs.Globpath.windows-latestin the WASM CI workflow.Closes #396
Test plan
node packages/npm-wasm/test/smoke.cjspasses on Windows (install + listInstalled + uninstall round-trip)node packages/npm-wasm/test/worker.test.cjspasses on Windowsgo test ./config/...passes natively on Windowsgo vet ./config/...passes for bothGOOS=jsand native targets🤖 Generated with Claude Code