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-30 19:35:05 +0400
committerBert Belder <bertbelder@gmail.com>2012-01-30 19:35:27 +0400
commit836344c90ed139f2e18bbcfb18d0ff2e2e42da81 (patch)
treed06a79efa537b0968920cdb593611adeff4e1f9a /doc
parent52bd0f93bb786de028463ef56ddb1e22568584b9 (diff)
Add disconnect method to forked child processes
This disconnect method allows the child to exit gracefully. This also adds a disconnect event and connect property.
Diffstat (limited to 'doc')
-rw-r--r--doc/api/child_processes.markdown14
1 files changed, 13 insertions, 1 deletions
diff --git a/doc/api/child_processes.markdown b/doc/api/child_processes.markdown
index a7c174c67e6..57aa9452098 100644
--- a/doc/api/child_processes.markdown
+++ b/doc/api/child_processes.markdown
@@ -24,6 +24,13 @@ of the signal, otherwise `null`.
See `waitpid(2)`.
+### Event: 'disconnect'
+
+This event is emitted after using the `.disconnect()` method in the parent or
+in the child. After disconnecting it is no longer possible to send messages.
+An alternative way to check if you can send messages is to see if the
+`child.connected` property is `true`.
+
### child.stdin
A `Writable Stream` that represents the child process's `stdin`.
@@ -264,7 +271,12 @@ processes:
}
});
-
+To close the IPC connection between parent and child use the
+`child.disconnect()` method. This allows the child to exit gracefully since
+there is no IPC channel keeping it alive. When calling this method the
+`disconnect` event will be emitted in both parent and child, and the
+`connected` flag will be set to `false`. Please note that you can also call
+`process.disconnect()` in the child process.
### child.kill([signal])