mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
- replaced var with const/let. - removed all console.log() statements. - removed deaths and revivals vars. - wrapped beforexit listener callbacks with common.mustCall(). - removed exit event listener. PR-URL: https://github.com/nodejs/node/pull/10121 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
27 lines
605 B
JavaScript
27 lines
605 B
JavaScript
'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(() => {}));
|
|
}));
|
|
}
|