Repository navigation
fix(cli): pass forge args as an array so project paths with spaces work - #5303
theluckystrike wants to merge 1 commit into
Conversation
|
@theluckystrike is attempting to deploy a commit to the Wevm Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: 4b29d04 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
tydavid5
left a comment
There was a problem hiding this comment.
Reviewed the fix against the reported bug, and it checks out.
Root cause is right: the foundry plugin built forge clean and forge build as template strings passed to execSync, so a project path with a space was split into two arguments by the shell. Switching to execFileSync with the arguments as an array fixes that at the source, and removing shell: true from the forge config call through spawnSync closes the same hole there.
I checked the rest of packages/cli/src/plugins/foundry.ts at this head. There is no execSync left in the file. The spawn call for the build output already passes its arguments as an array, and the forge --version check is now execFileSync with ['--version'] too, so the fix is complete across the file, not just for clean and build.
The test covers the reported case well. It creates a project folder called my project, runs the plugin against a fake forge script, and asserts the exact arguments received for config, clean and build, with the full project path as one argument each time. That is the exact failure the issue describes, and the test would fail on the old string based calls.
One note, not a blocker: the new test is skipped on win32, so a Windows path with spaces is still not covered by a test here. execFileSync without a shell is still the right direction on Windows, but the coverage gap is worth knowing.
Approving, the fix is correct and tested.
The
foundryplugin built itsforge cleanandforge buildcalls as template strings passed toexecSync, so a project path with a space was split into two arguments.forge confighad the same problem throughspawnSync(..., { shell: true }), which joins the array back into one string, so its result was silently dropped and the plugin fell back to the defaultoutdir. The result is "Artifacts not found." for any project under a folder like~/My Projects/app.This switches
clean,buildand--versiontoexecFileSyncwith an argument array, and dropsshell: truefrom theconfigcall. The--watchpath already usedspawnwith an array.The new test points the plugin at a stub
forgeand a project dir namedmy project, then checks that every--rootvalue arrives as one argument.Biome and
tsgo --noEmitfor@wagmi/cliare clean. Changeset added.