[PR #3163] [MERGED] fix: spawn node and git without cmd shell in server build scripts #5824

Closed
opened 2026-10-22 04:19:52 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3163
Author: @kolacheee
Created: 7/2/2026
Status: ✅ Merged
Merged: 7/3/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/server-build-execpath-no-shell


📝 Commits (1)

  • 5b99f40 fix: spawn node and git without cmd shell in server build scripts

📊 Changes

2 files changed (+4 additions, -3 deletions)

View changed files

📝 packages/server/scripts/build.mjs (+4 -2)
📝 packages/server/scripts/write-build-meta.mjs (+0 -1)

📄 Description

Linked issue

Closes #3162

Why this change

  • On Windows with Node.js in its default install location (C:\Program Files\nodejs), pnpm check and pnpm build fail on staging: the server build script spawns process.execPath through cmd.exe (spawnSync with shell: true), which concatenates the command line unquoted and splits the path at the space — 'C:\Program' is not recognized as an internal or external command. This breaks the baseline validation command for every Windows contributor on a default Node install. Introduced with the build script in #3157; not present on main.

What changed

  • packages/server/scripts/build.mjs: the run() helper now accepts a per-call shell override, and the write-build-meta.mjs step passes shell: false. Spawning node.exe directly needs no shell (it's a real executable, not a .cmd shim), and without a shell the args are passed verbatim — which also fixes the same breakage for repos cloned into paths containing spaces. The tsc invocation keeps the shell, which it genuinely needs on Windows to resolve the .cmd shim.
  • packages/server/scripts/write-build-meta.mjs: dropped the unnecessary shell: process.platform === "win32" from the execFileSync("git", ...) call — same root pattern in the same build path. git is a real executable and needs no shell; the shell also triggered Node's DEP0190 deprecation warning (unescaped args) on every Windows server build.

Scope note: the other spawn call sites were checked for the same pattern. packages/client/scripts/build.mjs shares the run() helper but only invokes tsc/vite (bare .cmd shim names that require the shell on Windows — its DEP0190 warning is unavoidable without larger changes, and it works). run-tests.mjs and check-impeccable-context.mjs already spawn process.execPath without a shell, which is the correct pattern this PR aligns with.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

What was already exercised while preparing this PR (agent-run on Windows 11, Node in C:\Program Files\nodejs — the affected environment; re-verify yourself before ticking boxes above):

  • Reproduced the failure before the fix: pnpm --filter @marinara-engine/server build exited 1 with 'C:\Program' is not recognized after tsc completed.
  • After the fix: pnpm --filter @marinara-engine/server build exits 0 and dist/config/build-meta.json is written with the correct commit hash, confirming write-build-meta.mjs actually ran.
  • Full pnpm check (impeccable check + lint + production build of all packages) exits 0.
  • pnpm guard:installer-artifacts exits 0.

Still needs manual verification by a human:

  • Manually verify pnpm check passes on this branch on your own machine (ideally Windows with Node under C:\Program Files).
  • Manually verify the build still passes on a non-Windows machine (macOS/Linux/Termux) — the shell default is unchanged there, so no behavior difference is expected, but it hasn't been exercised in this session.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

No docs impact expected: internal build-tooling fix with no user-visible behavior change and no version bump.

UI evidence (if applicable)

Not applicable — build tooling only, no UI change.

Summary by CodeRabbit

  • Bug Fixes
    • Improved build reliability on Windows, especially when paths contain spaces.
    • Made build metadata generation more consistent across environments, reducing the chance of failures during packaging.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/3163 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 7/2/2026 **Status:** ✅ Merged **Merged:** 7/3/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/server-build-execpath-no-shell` --- ### 📝 Commits (1) - [`5b99f40`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5b99f4025325c82c081683edf9e57e292d56e658) fix: spawn node and git without cmd shell in server build scripts ### 📊 Changes **2 files changed** (+4 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/scripts/build.mjs` (+4 -2) 📝 `packages/server/scripts/write-build-meta.mjs` (+0 -1) </details> ### 📄 Description ## Linked issue Closes #3162 ## Why this change - On Windows with Node.js in its default install location (`C:\Program Files\nodejs`), `pnpm check` and `pnpm build` fail on `staging`: the server build script spawns `process.execPath` through `cmd.exe` (`spawnSync` with `shell: true`), which concatenates the command line unquoted and splits the path at the space — `'C:\Program' is not recognized as an internal or external command`. This breaks the baseline validation command for every Windows contributor on a default Node install. Introduced with the build script in #3157; not present on `main`. ## What changed - `packages/server/scripts/build.mjs`: the `run()` helper now accepts a per-call `shell` override, and the `write-build-meta.mjs` step passes `shell: false`. Spawning `node.exe` directly needs no shell (it's a real executable, not a `.cmd` shim), and without a shell the args are passed verbatim — which also fixes the same breakage for repos cloned into paths containing spaces. The `tsc` invocation keeps the shell, which it genuinely needs on Windows to resolve the `.cmd` shim. - `packages/server/scripts/write-build-meta.mjs`: dropped the unnecessary `shell: process.platform === "win32"` from the `execFileSync("git", ...)` call — same root pattern in the same build path. `git` is a real executable and needs no shell; the shell also triggered Node's `DEP0190` deprecation warning (unescaped args) on every Windows server build. Scope note: the other spawn call sites were checked for the same pattern. `packages/client/scripts/build.mjs` shares the `run()` helper but only invokes `tsc`/`vite` (bare `.cmd` shim names that require the shell on Windows — its `DEP0190` warning is unavoidable without larger changes, and it works). `run-tests.mjs` and `check-impeccable-context.mjs` already spawn `process.execPath` without a shell, which is the correct pattern this PR aligns with. ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes What was already exercised while preparing this PR (agent-run on Windows 11, Node in `C:\Program Files\nodejs` — the affected environment; re-verify yourself before ticking boxes above): - Reproduced the failure before the fix: `pnpm --filter @marinara-engine/server build` exited 1 with `'C:\Program' is not recognized` after `tsc` completed. - After the fix: `pnpm --filter @marinara-engine/server build` exits 0 and `dist/config/build-meta.json` is written with the correct commit hash, confirming `write-build-meta.mjs` actually ran. - Full `pnpm check` (impeccable check + lint + production build of all packages) exits 0. - `pnpm guard:installer-artifacts` exits 0. Still needs manual verification by a human: - Manually verify `pnpm check` passes on this branch on your own machine (ideally Windows with Node under `C:\Program Files`). - Manually verify the build still passes on a non-Windows machine (macOS/Linux/Termux) — the `shell` default is unchanged there, so no behavior difference is expected, but it hasn't been exercised in this session. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) No docs impact expected: internal build-tooling fix with no user-visible behavior change and no version bump. ## UI evidence (if applicable) Not applicable — build tooling only, no UI change. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved build reliability on Windows, especially when paths contain spaces. * Made build metadata generation more consistent across environments, reducing the chance of failures during packaging. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:19:52 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#5824
No description provided.