doc: clean up isDead() example

This commit removes extra whitespace and some awkward text
containing typos from the cluster worker.isDead() code
sample.

PR-URL: https://github.com/nodejs/node/pull/28421
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
cjihrig 2019-06-25 08:22:02 -04:00
parent 94454927f6
commit 63a5cd87ea
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -401,19 +401,14 @@ if (cluster.isMaster) {
cluster.on('exit', (worker, code, signal) => { cluster.on('exit', (worker, code, signal) => {
console.log('worker is dead:', worker.isDead()); console.log('worker is dead:', worker.isDead());
}); });
} else { } else {
// Workers can share any TCP connection // Workers can share any TCP connection. In this case, it is an HTTP server.
// In this case it is an HTTP server
http.createServer((req, res) => { http.createServer((req, res) => {
res.writeHead(200); res.writeHead(200);
res.end(`Current process\n ${process.pid}`); res.end(`Current process\n ${process.pid}`);
process.kill(process.pid); process.kill(process.pid);
}).listen(8000); }).listen(8000);
// Make http://localhost:8000 to ckeck isDead method.
} }
``` ```
### worker.kill([signal='SIGTERM']) ### worker.kill([signal='SIGTERM'])