Skip to content

Commit

Permalink
chore(build): fix build error on Windows (#11389)
Browse files Browse the repository at this point in the history
  • Loading branch information
phk422 authored Jul 19, 2024
1 parent fd5c001 commit c7f5c70
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ export function fuzzyMatchTarget(partialTargets, includeAllMatching) {
*/
export async function exec(command, args, options) {
return new Promise((resolve, reject) => {
const process = spawn(command, args, {
const _process = spawn(command, args, {
stdio: [
'ignore', // stdin
'pipe', // stdout
'pipe', // stderr
],
...options,
shell: process.platform === 'win32',
})

/**
Expand All @@ -78,19 +79,19 @@ export async function exec(command, args, options) {
*/
const stdoutChunks = []

process.stderr?.on('data', chunk => {
_process.stderr?.on('data', chunk => {
stderrChunks.push(chunk)
})

process.stdout?.on('data', chunk => {
_process.stdout?.on('data', chunk => {
stdoutChunks.push(chunk)
})

process.on('error', error => {
_process.on('error', error => {
reject(error)
})

process.on('exit', code => {
_process.on('exit', code => {
const ok = code === 0
const stderr = Buffer.concat(stderrChunks).toString().trim()
const stdout = Buffer.concat(stdoutChunks).toString().trim()
Expand Down

0 comments on commit c7f5c70

Please sign in to comment.