From 7e8ab82723a9ff840bc21eaa79ef49ecc7094e24 Mon Sep 17 00:00:00 2001 From: Tarun Garg Date: Tue, 28 Jun 2016 01:47:13 +0530 Subject: [PATCH 1/7] Updated ReadMe for #7434 --- doc/api/process.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/process.md b/doc/api/process.md index 34738d76ad3020..1b04249bad9b1c 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -452,7 +452,7 @@ added: v0.1.27 The `process.argv` property returns a array containing the command line arguments passed when the Node.js process was launched. The first element will -be 'node', the second element will be the name of the JavaScript file. The +be [`process.execPath()`], the second element will be the name of the JavaScript file. The remaining elements will be any additional command line arguments. For example, assuming the following script for `process-args.js`: @@ -1663,6 +1663,7 @@ cases: [`process.argv`]: #process_process_argv [`process.exit()`]: #process_process_exit_code [`process.kill()`]: #process_process_kill_pid_signal +[`process.execPath()`]: #process_process_execPath [`promise.catch()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch [`require.main`]: modules.html#modules_accessing_the_main_module [`setTimeout(fn, 0)`]: timers.html#timers_settimeout_callback_delay_arg From 1b1e5f641476d5089eda39a5516184b2d024465e Mon Sep 17 00:00:00 2001 From: tarungarg546 Date: Tue, 28 Jun 2016 02:46:02 +0530 Subject: [PATCH 2/7] docs:Modifying documentation for process.arv The current documentation states that if run something like node app.js then in our process.argv array first elements is node, but actually its process.execPath not node as documentation currently suggests This commit fixes this documentation bug. Fixes : nodejs#7434 PR-URL: nodejs#7449 --- doc/api/process.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/process.md b/doc/api/process.md index 1b04249bad9b1c..f4774c815c45f9 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -473,7 +473,7 @@ $ node process-2.js one two=three four Would generate the output: ```text -0: node +0: /usr/local/bin/node 1: /Users/mjr/work/node/process-2.js 2: one 3: two=three From e620fa0a9b98e8af69a82e3e3c3fddff15ace3b0 Mon Sep 17 00:00:00 2001 From: tarungarg546 Date: Wed, 29 Jun 2016 21:06:58 +0530 Subject: [PATCH 3/7] Changes as suggested by @mscdex & @cjihrig With this commit everyline of process documentation is wrapped in 80 characters and there are some changes for documention of process.arv[0] and process.argv[1] --- doc/api/process.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/process.md b/doc/api/process.md index f4774c815c45f9..a443cab09c833a 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -452,8 +452,8 @@ added: v0.1.27 The `process.argv` property returns a array containing the command line arguments passed when the Node.js process was launched. The first element will -be [`process.execPath()`], the second element will be the name of the JavaScript file. The -remaining elements will be any additional command line arguments. +be [`process.execPath()`], second element will be the path to JavaScript file. +The remaining elements will be any additional command line arguments. For example, assuming the following script for `process-args.js`: From 7b0096ec082e726d9e8ea173e7df3f033af86760 Mon Sep 17 00:00:00 2001 From: tarungarg546 Date: Wed, 29 Jun 2016 21:54:24 +0530 Subject: [PATCH 4/7] Changes as suggested by @mscdex & @cjihrig With this commit everyline of process documentation is wrapped in 80 characters and there are some changes for documention of process.arv[0] and process.argv[1] --- doc/api/process.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/api/process.md b/doc/api/process.md index a443cab09c833a..4e0c9c568ee348 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -451,8 +451,9 @@ added: v0.1.27 --> The `process.argv` property returns a array containing the command line -arguments passed when the Node.js process was launched. The first element will -be [`process.execPath()`], second element will be the path to JavaScript file. +arguments passed when the Node.js process was launched. +The first element will be [`process.execPath()`], +The second element will be the path to the JavaScript file being executed. The remaining elements will be any additional command line arguments. For example, assuming the following script for `process-args.js`: From 4cd40266b5c13296b03b511879743b1e1e009167 Mon Sep 17 00:00:00 2001 From: tarungarg546 Date: Wed, 29 Jun 2016 22:58:34 +0530 Subject: [PATCH 5/7] Changes as suggested by @mscdex & @cjihrig With this commit everyline of process documentation is wrapped in 80 characters and there are some changes for documention of process.arv[0] and process.argv[1] --- doc/api/process.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/api/process.md b/doc/api/process.md index 4e0c9c568ee348..0be594b2a917a7 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -450,11 +450,11 @@ console.log(`This processor architecture is ${process.arch}`); added: v0.1.27 --> -The `process.argv` property returns a array containing the command line -arguments passed when the Node.js process was launched. -The first element will be [`process.execPath()`], -The second element will be the path to the JavaScript file being executed. -The remaining elements will be any additional command line arguments. +The `process.argv` property returns a array containing the command line +arguments passed when the Node.js process was launched.The first element will +be [`process.execPath()`]. The second element will be the path to the +JavaScript file being executed. The remaining elements will be any additional +command line arguments. For example, assuming the following script for `process-args.js`: From 9afa7fd0cdb82de3b0dc8c1e311aa8634c28238e Mon Sep 17 00:00:00 2001 From: tarungarg546 Date: Thu, 30 Jun 2016 00:03:46 +0530 Subject: [PATCH 6/7] Minor grammatical changes in doc for process api These changes are just some grammatical changes like using `an` not `a` and space after period etc. --- doc/api/process.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/process.md b/doc/api/process.md index 0be594b2a917a7..3f87fc38e01b17 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -450,8 +450,8 @@ console.log(`This processor architecture is ${process.arch}`); added: v0.1.27 --> -The `process.argv` property returns a array containing the command line -arguments passed when the Node.js process was launched.The first element will +The `process.argv` property returns an array containing the command line +arguments passed when the Node.js process was launched. The first element will be [`process.execPath()`]. The second element will be the path to the JavaScript file being executed. The remaining elements will be any additional command line arguments. From 69456e43d25e4bf67d8173a254dfedd2eaa1a639 Mon Sep 17 00:00:00 2001 From: tarungarg546 Date: Fri, 1 Jul 2016 15:21:16 +0530 Subject: [PATCH 7/7] Drop paranthesis around `process.execPath` --- doc/api/process.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/process.md b/doc/api/process.md index 3f87fc38e01b17..58df1d33140488 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -452,7 +452,7 @@ added: v0.1.27 The `process.argv` property returns an array containing the command line arguments passed when the Node.js process was launched. The first element will -be [`process.execPath()`]. The second element will be the path to the +be [`process.execPath`]. The second element will be the path to the JavaScript file being executed. The remaining elements will be any additional command line arguments. @@ -1664,7 +1664,7 @@ cases: [`process.argv`]: #process_process_argv [`process.exit()`]: #process_process_exit_code [`process.kill()`]: #process_process_kill_pid_signal -[`process.execPath()`]: #process_process_execPath +[`process.execPath`]: #process_process_execPath [`promise.catch()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch [`require.main`]: modules.html#modules_accessing_the_main_module [`setTimeout(fn, 0)`]: timers.html#timers_settimeout_callback_delay_arg