-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
fix: do not mutate process.argv #36
Conversation
Thanks, I won't be able to return to a computer until tonight. Have you confirmed that this works upstream? |
Assuming you meant downstream -- in the issues/PRs/comments I linked, I've said that a temporary workaround is to downgrade to 1.7.0. I did that manually in my I only changed one line in the source so that Tried to also stay consistent with your style (tabs, |
If you meant confirming the fix downstream, yes, I manually edited my |
- 1.7.1 introduced some arr.splice's into the code, which caused mutations in process.argv, affecting downstream code - set arr to a clone of process.argv instead so it can be freely mutated after - explicitly call the parameter processArgv so code is written more carefully when dealing with it - add a test to ensure process.argv is not mutated
f9d54a0
to
8a6a568
Compare
Yes I meant local downstream testing. I also followed up on your other references here. Thanks for the investigations & the fix! Sorry for the trouble in the first place 🙈 Also apologies on the slight delay – I am traveling this weekend (of all weekends!) |
Thanks for getting this merged in quick before it became a much larger issue downstream 🙂
Not sure what you meant by this
I mean, that test failed on 1.7.1 & 1.7.2, so I wouldn't say it hit nothing. I originally tried to add the test inside the We have very different programming styles and this is your library, but thought I'd throw in my 2¢:
Again, just my 2¢ I think TSDX accounts for like 1/3 of |
1.7.1 introduced some arr.splice's into the code, which caused
mutations in process.argv, affecting downstream code
set arr to a clone of process.argv instead so it can be freely
mutated after
explicitly call the parameter processArgv so code is written more
carefully when dealing with it
add a test to ensure process.argv is not mutated
Hi @lukeed -- I'm writing this as URGENT as it would appear some code in 1.7.1 was introduced that mutated
process.argv
, which is causing issues downstream, see jaredpalmer/tsdx#511 (comment) , agilgur5/jest-without-globals#2 (comment) .Note that the test I added fails on 1.7.1 and 1.7.2. The Usage docs also say to pass
process.argv
directly toparse
(not a clone), so internal usage should be very careful when using it.Could we get this merged and published ASAP before it affects more code downstream?
It causes some extremely confusing errors and it was very time-consuming for me to figure out what was happening and where it was coming from 😕