mirror of https://github.com/lukechilds/node.git
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.
26 lines
605 B
26 lines
605 B
'use strict';
|
|
const common = require('../common');
|
|
const net = require('net');
|
|
|
|
process.once('beforeExit', common.mustCall(tryImmediate));
|
|
|
|
function tryImmediate() {
|
|
setImmediate(common.mustCall(() => {
|
|
process.once('beforeExit', common.mustCall(tryTimer));
|
|
}));
|
|
}
|
|
|
|
function tryTimer() {
|
|
setTimeout(common.mustCall(() => {
|
|
process.once('beforeExit', common.mustCall(tryListen));
|
|
}), 1);
|
|
}
|
|
|
|
function tryListen() {
|
|
net.createServer()
|
|
.listen(0)
|
|
.on('listening', common.mustCall(function() {
|
|
this.close();
|
|
process.on('beforeExit', common.mustCall(() => {}));
|
|
}));
|
|
}
|
|
|