GoogleCloudPlatform/jobs-demos

`splice()` of `argv` array gives unexpected result

jasonpolites opened this issue · 1 comments

I'm not sure if possibly the contents of argv changed since this sample was published, but the current impl produces the wrong outcome.

When testing, I observed that argv contains:

["/usr/local/bin/node","/home/pptruser/screenshot.js","screenshot.js","https://example.com","https://cloud.google.com"]

This line which uses splice(2), should probably be splice(3)

main(process.argv.slice(2)).catch((err) => {

Or switch to node.js 20 and use parseArgs, the new built-in CLI flag parser