Skip to content

Commit

Permalink
fix(scripts): fix spawn util
Browse files Browse the repository at this point in the history
  • Loading branch information
dangreen committed Jan 1, 2025
1 parent 6d5da33 commit 2198ca8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion packages/scripts/src/utils/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ import { getArgs } from './args.js'
export async function runSerial(pm, scripts, pkg) {
const cmds = scripts.map(script => getArgs(pm, script, pkg))
let exitCode = 0
let result

for (const [bin, args] of cmds) {
exitCode = exitCode || (await spawn(bin, args)).exitCode
result = await spawn(bin, args)
exitCode = exitCode || result.exitCode

if (result.output) {
process.stdout.write(result.output)
}
}

return exitCode
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/src/utils/spawn.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function spawn(cmd, args, stdio = true) {
const onDone = (error) => {
resolve({
exitCode: child.exitCode,
output: output || error
output: output || (typeof error === 'number' ? '' : `${error}\n`)
})
}

Expand Down

0 comments on commit 2198ca8

Please sign in to comment.