From 885a0a9a00b2e5df0557648f44862bca49d1b659 Mon Sep 17 00:00:00 2001 From: Noah Lan <6995syu@163.com> Date: Tue, 17 Mar 2026 18:59:35 +0800 Subject: [PATCH] fix: build.mjs commands could not be executed correctly. (#7682) * fix: Fix issue where commands could not be executed correctly when they contained spaces * chore: oxfmt --- internal/node-utils/scripts/build.mjs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/node-utils/scripts/build.mjs b/internal/node-utils/scripts/build.mjs index c38b4914c..65a64e9c4 100644 --- a/internal/node-utils/scripts/build.mjs +++ b/internal/node-utils/scripts/build.mjs @@ -1,8 +1,7 @@ import { spawnSync } from 'node:child_process'; const pnpmCommand = - process.env.npm_execpath && - process.env.npm_execpath.endsWith('.cjs') + process.env.npm_execpath && process.env.npm_execpath.endsWith('.cjs') ? [process.execPath, process.env.npm_execpath] : ['pnpm']; @@ -22,7 +21,11 @@ const steps = [ for (const args of steps) { const [command, ...commandArgs] = pnpmCommand; - const result = spawnSync(command, [...commandArgs, ...args], { + let cmd = command; + if (cmd.includes(' ')) { + cmd = `"${command}"`; + } + const result = spawnSync(cmd, [...commandArgs, ...args], { shell: true, stdio: 'inherit', });