process: argv1 property to preserve original argv[1]#49918
process: argv1 property to preserve original argv[1]#49918GeoffreyBooth wants to merge 5 commits intonodejs:mainfrom
argv1 property to preserve original argv[1]#49918Conversation
|
Review requested:
|
257fbfe to
d9cf132
Compare
d9cf132 to
75cd731
Compare
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
|
Thinking about the overall concept, I think it would probably make more sense to introduce something like |
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Maybe we can do both? It feels wrong to have |
|
I don't think we really need |
|
Whatever what name we decide to go with, it'd be very useful to find a way to expose the info to loader thread. |
So it’s the new value of |
|
I'd rather not create a We should be explicit about what we're exposing and why so I feel it should have a better name and, yes, resolving first is probably ideal, for consistency. |
It exists because I don’t know what the use cases are for having the input before it gets resolved, and that’s a good argument for not needing |
|
Yes, I'm aware of what |
|
I opened this PR because I was surprised to see that we had If we want to add additional properties like |
|
I don't think having |
Because Node doesn’t reassign
Agreed! But what we have is |
Following up #49869, supporting #49432, this PR creates a new
process.argv1property similar toprocess.argv0.Just as
process.argv0preserves the original value ofargv[0]before Node replaces it with the absolute path to the executable,process.argv1preserves the original value ofargv[1]before Node replaces it with the absolute path to the entry point.There are also some refactors to how some of the “pre-execution” functions interact. I refactored options objects into parameters, as I’m told that generally parameters are faster; and the post-replacement
argv[1]is returned to the caller, rather than the caller relying on theprocess.argv[1]global. I also added some JSDoc and comments. @nodejs/startup