| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6a08535 commit 09349a8
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -722,6 +722,9 @@ function workerInit() { | |||
| 722 | 722 | var seq = 0; | |
| 723 | 723 | var callbacks = {}; | |
| 724 | 724 | function sendHelper(proc, message, handle, cb) { | |
| 725 | + if (!proc.connected) | ||
| 726 | + return false; | ||
| 727 | + | ||
| 725 | 728 | // Mark message as internal. See INTERNAL_PREFIX in lib/child_process.js | |
| 726 | 729 | message = util._extend({ cmd: 'NODE_CLUSTER' }, message); | |
| 727 | 730 | if (cb) callbacks[seq] = cb; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,18 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const assert = require('assert'); | ||
| 4 | + const cluster = require('cluster'); | ||
| 5 | + | ||
| 6 | + if (cluster.isMaster) { | ||
| 7 | + const worker = cluster.fork(); | ||
| 8 | + worker.on('exit', common.mustCall((code, signal) => { | ||
| 9 | + assert.strictEqual(code, 0, 'worker did not exit normally'); | ||
| 10 | + assert.strictEqual(signal, null, 'worker did not exit normally'); | ||
| 11 | + })); | ||
| 12 | + } else { | ||
| 13 | + const net = require('net'); | ||
| 14 | + const server = net.createServer(); | ||
| 15 | + server.listen(common.PORT, common.mustCall(() => { | ||
| 16 | + process.disconnect(); | ||
| 17 | + })); | ||
| 18 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments