Skip to content

process: `argv1` property to preserve original `argv[1]`

Rodrigo Muino Tomonari requested to merge github/fork/GeoffreyBooth/argv1 into main

Following up https://github.com/nodejs/node/pull/49869, supporting https://github.com/nodejs/node/issues/49432, this PR creates a new process.argv1 property similar to process.argv0.

Just as process.argv0 preserves the original value of argv[0] before Node replaces it with the absolute path to the executable, process.argv1 preserves the original value of argv[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 the process.argv[1] global. I also added some JSDoc and comments. @nodejs/startup

Merge request reports

Loading