Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAndreas Madsen <amwebdk@gmail.com>2012-01-05 23:09:43 +0400
committerRyan Dahl <ry@tinyclouds.org>2012-01-21 01:09:56 +0400
commitf9a47debfca854666e45de299b0bb630db4a1548 (patch)
tree44ee8fcb77d1675d0a0eab99dd2fceaa4051abd1 /doc
parent6b5853794d77094f960795cacf21d37841f1a890 (diff)
Add cluster.setupMaster
Fixes #2470
Diffstat (limited to 'doc')
-rw-r--r--doc/api/cluster.markdown34
1 files changed, 34 insertions, 0 deletions
diff --git a/doc/api/cluster.markdown b/doc/api/cluster.markdown
index 96e4ef8f37a..d5916e6028c 100644
--- a/doc/api/cluster.markdown
+++ b/doc/api/cluster.markdown
@@ -101,6 +101,40 @@ This can be used to restart the worker by calling `fork()` again.
cluster.fork();
});
+### Event 'setup'
+
+When the `.setupMaster()` function has been executed this event emits. If `.setupMaster()`
+was not executed before `fork()` or `.autoFork()`, they will execute the function with no
+arguments.
+
+### cluster.setupMaster([options])
+
+The `setupMaster` is used to change the default 'fork' behavior. It takes one option
+object argument.
+
+Example:
+
+ var cluster = require("cluster");
+ cluster.setupMaster({
+ exec : "worker.js",
+ args : ["--use", "https"],
+ silent : true
+ });
+ cluster.autoFork();
+
+The options argument can contain 3 different properties.
+
+- `exec` are the file path to the worker file, by default this is the same file as the master.
+- `args` are a array of arguments send along with the worker, by default this is `process.argv.slice(2)`.
+- `silent`, if this option is true the output of a worker won't propagate to the master, by default this is false.
+
+### cluster.settings
+
+All settings set by the `.setupMaster` is stored in this settings object.
+This object is not supposed to be change or set manually, by you.
+
+All propertys are `undefined` if they are not yet set.
+
### cluster.fork([env])
Spawn a new worker process. This can only be called from the master process.