-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
util: fix parseArgs skipping first positional arg with --eval= and --… #60814
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add tests please
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #60814 +/- ##
==========================================
- Coverage 88.56% 88.55% -0.01%
==========================================
Files 703 703
Lines 208254 208254
Branches 40156 40165 +9
==========================================
- Hits 184430 184428 -2
- Misses 15828 15830 +2
Partials 7996 7996
🚀 New features to boost your workflow:
|
bc85468 to
8ed13dc
Compare
a89d8c5 to
5919b08
Compare
5919b08 to
edb11e6
Compare
Renegade334
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!
|
Thanks for the guidance, appreciate it! |
Fix: handle
--eval=and--print=correctly ingetMainArgs()Fixes #60808
parseArgs()was skipping the first positional argument when Node was startedwith
--eval=or--print=. The logic only checked for--eval/--printand missed the
--eval=.../--print=...forms.This patch adds
startsWith('--eval=')andstartsWith('--print=')checks sogetMainArgs()returns the correct slice ofprocess.argv.After this fix, positional arguments are preserved correctly for all eval/print forms.