You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

19 lines
533 B

'use strict';
const common = require('../common');
const assert = require('assert');
const cluster = require('cluster');
const net = require('net');
if (cluster.isMaster) {
cluster.fork();
cluster.on('listening', common.mustCall(function(worker, address) {
const port = address.port;
// ensure that the port is not 0 or null
assert(port);
// ensure that the port is numerical
assert.strictEqual(typeof port, 'number');
worker.kill();
}));
} else {
net.createServer(common.mustNotCall()).listen(0);
}