Skip to content

Commit

Permalink
doc: fixes in cluster.md
Browse files Browse the repository at this point in the history
* Capitalization and punctuation.

* `setupMaster` contained info about `settings` which where incomplete.

PR-URL: #14140
Fixes: #8495
Fixes: #12941
Refs: #9659
Refs: #13761
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
mutantcornholio authored and addaleax committed Jul 18, 2017
1 parent f5bea63 commit c0703f0
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions doc/api/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -734,12 +734,12 @@ changes:
-->

* {Object}
* `execArgv` {Array} list of string arguments passed to the Node.js
* `execArgv` {Array} List of string arguments passed to the Node.js
executable. (Default=`process.execArgv`)
* `exec` {string} file path to worker file. (Default=`process.argv[1]`)
* `args` {Array} string arguments passed to worker.
* `exec` {string} File path to worker file. (Default=`process.argv[1]`)
* `args` {Array} String arguments passed to worker.
(Default=`process.argv.slice(2)`)
* `silent` {boolean} whether or not to send output to parent's stdio.
* `silent` {boolean} Whether or not to send output to parent's stdio.
(Default=`false`)
* `stdio` {Array} Configures the stdio of forked processes. Because the
cluster module relies on IPC to function, this configuration must contain an
Expand All @@ -761,26 +761,19 @@ changes:
description: The `stdio` option is supported now.
-->

* `settings` {Object}
* `exec` {string} file path to worker file. (Default=`process.argv[1]`)
* `args` {Array} string arguments passed to worker.
(Default=`process.argv.slice(2)`)
* `silent` {boolean} whether or not to send output to parent's stdio.
(Default=`false`)
* `stdio` {Array} Configures the stdio of forked processes. When this option
is provided, it overrides `silent`.
* `settings` {Object} see [`cluster.settings`][]

`setupMaster` is used to change the default 'fork' behavior. Once called,
the settings will be present in `cluster.settings`.

Note that:

* any settings changes only affect future calls to `.fork()` and have no
effect on workers that are already running
* Any settings changes only affect future calls to `.fork()` and have no
effect on workers that are already running.
* The *only* attribute of a worker that cannot be set via `.setupMaster()` is
the `env` passed to `.fork()`
* the defaults above apply to the first call only, the defaults for later
calls is the current value at the time of `cluster.setupMaster()` is called
the `env` passed to `.fork()`.
* The defaults above apply to the first call only, the defaults for later
calls is the current value at the time of `cluster.setupMaster()` is called.

Example:

Expand Down Expand Up @@ -868,3 +861,4 @@ socket.on('data', (id) => {
[Child Process module]: child_process.html#child_process_child_process_fork_modulepath_args_options
[child_process event: 'exit']: child_process.html#child_process_event_exit
[child_process event: 'message']: child_process.html#child_process_event_message
[`cluster.settings`]: #clustersettings

0 comments on commit c0703f0

Please sign in to comment.