1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
'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(() => {}));
}));
}
|