Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 63d361b

Browse filesBrowse files
tarungarg546Fishrock123
authored andcommitted
doc: fix documentation of process.argv
The current documentation states that if run something like `node app.js` then in our process.argv array first elements is `node`, but actually it's `process.execPath` not `node` as documentation currently suggests. Fixes: #7434 PR-URL: #7449 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent c132e9c commit 63d361b
Copy full SHA for 63d361b

File tree

Expand file treeCollapse file tree

1 file changed

+6
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-4
lines changed
Open diff view settings
Collapse file

‎doc/api/process.md‎

Copy file name to clipboardExpand all lines: doc/api/process.md
+6-4Lines changed: 6 additions & 4 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -450,10 +450,11 @@ console.log(`This processor architecture is ${process.arch}`);
450450
added: v0.1.27
451451
-->
452452

453-
The `process.argv` property returns a array containing the command line
453+
The `process.argv` property returns an array containing the command line
454454
arguments passed when the Node.js process was launched. The first element will
455-
be 'node', the second element will be the name of the JavaScript file. The
456-
remaining elements will be any additional command line arguments.
455+
be [`process.execPath`]. The second element will be the path to the
456+
JavaScript file being executed. The remaining elements will be any additional
457+
command line arguments.
457458

458459
For example, assuming the following script for `process-args.js`:
459460

@@ -473,7 +474,7 @@ $ node process-2.js one two=three four
473474
Would generate the output:
474475

475476
```text
476-
0: node
477+
0: /usr/local/bin/node
477478
1: /Users/mjr/work/node/process-2.js
478479
2: one
479480
3: two=three
@@ -1663,6 +1664,7 @@ cases:
16631664
[`process.argv`]: #process_process_argv
16641665
[`process.exit()`]: #process_process_exit_code
16651666
[`process.kill()`]: #process_process_kill_pid_signal
1667+
[`process.execPath`]: #process_process_execPath
16661668
[`promise.catch()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch
16671669
[`require.main`]: modules.html#modules_accessing_the_main_module
16681670
[`setTimeout(fn, 0)`]: timers.html#timers_settimeout_callback_delay_arg

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.