Skip to content

Commit

Permalink
fix(cli): duplicate execArgv options may break node
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Feb 21, 2022
1 parent 3083af3 commit 9435779
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/cli/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@ function toArg(key: string) {
}

function createWorker(options: Dict<any>) {
const execArgv = Object.entries(options).flatMap<string>(([key, value]) => key === '--' ? [] : [toArg(key), value])
const execArgv = Object.entries(options).flatMap<string>(([key, value]) => {
if (key === '--') return []
key = toArg(key)
if (Array.isArray(value)) {
return value.flatMap(value => [key, value])
} else {
return [key, value]
}
})
execArgv.push(...options['--'])

child = fork(resolve(__dirname, 'worker'), [], {
Expand Down

0 comments on commit 9435779

Please sign in to comment.