diff options
author | Andreas Madsen <amwebdk@gmail.com> | 2012-01-30 16:35:05 +0100 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2012-01-30 16:35:27 +0100 |
commit | 836344c90ed139f2e18bbcfb18d0ff2e2e42da81 (patch) | |
tree | d06a79efa537b0968920cdb593611adeff4e1f9a /doc/api/child_processes.markdown | |
parent | 52bd0f93bb786de028463ef56ddb1e22568584b9 (diff) | |
download | node-new-836344c90ed139f2e18bbcfb18d0ff2e2e42da81.tar.gz |
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/api/child_processes.markdown')
-rw-r--r-- | doc/api/child_processes.markdown | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/doc/api/child_processes.markdown b/doc/api/child_processes.markdown index a7c174c67e..57aa945209 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]) |