Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

splice() of argv array gives unexpected result #36

Open
jasonpolites opened this issue May 22, 2023 · 1 comment
Open

splice() of argv array gives unexpected result #36

jasonpolites opened this issue May 22, 2023 · 1 comment

Comments

@jasonpolites
Copy link

jasonpolites commented May 22, 2023

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) => {

@steren
Copy link
Collaborator

steren commented May 22, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants