Skip to content

Commit

Permalink
Parse correctly when Node runs with --eval or -e
Browse files Browse the repository at this point in the history
  • Loading branch information
zawataki committed Mar 27, 2019
1 parent 6ef337e commit 3da987f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/argv-tools.mjs
Expand Up @@ -37,7 +37,10 @@ class ArgvArray extends Array {
} else {
/* if no argv supplied, assume we are parsing process.argv */
argv = process.argv.slice(0)
argv.splice(0, 2)

const deleteCount =
process.execArgv.some(val => ['--eval', '-e'].includes(val)) ? 1 : 2
argv.splice(0, deleteCount)
}
argv.forEach(arg => this.push(String(arg)))
}
Expand Down

0 comments on commit 3da987f

Please sign in to comment.