Browse Source
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
pull/7688/head
Noah Lan
6 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
6 additions and
3 deletions
-
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', |
|
|
|
}); |
|
|
|
|