Skip to content

Commit 108b1c7

Browse files
committed
doc: clarify process.argv[1] behavior for -e/--eval
1 parent 4e1f39b commit 108b1c7

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

doc/api/process.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,8 +835,10 @@ The `process.argv` property returns an array containing the command-line
835835
arguments passed when the Node.js process was launched. The first element will
836836
be [`process.execPath`][]. See `process.argv0` if access to the original value
837837
of `argv[0]` is needed. The second element will be the path to the JavaScript
838-
file being executed. The remaining elements will be any additional command-line
839-
arguments.
838+
file being executed, if a script file is provided. For no-script execution
839+
modes such as `-e` or `--eval`, the second element is the first unconsumed
840+
command-line argument. The remaining elements will be any additional
841+
command-line arguments.
840842

841843
For example, assuming the following script for `process-args.js`:
842844

0 commit comments

Comments
 (0)