Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
callback = callback || function() {};
report = report || [];
logger.trace('cleanUpAndExit: signal: %s', signal);
try {
server.close();
} catch (e) {
logger.debug('Server already closed');
}
if (statusPoller) {
statusPoller.stop();
}
try {
process.kill(tunnel.process.pid, 'SIGTERM');
} catch (e) {
logger.debug('Non existent tunnel');
}
if (signal === 'SIGTERM') {
logger.debug('Exiting');
callback(error, report);
} else {
terminateAllWorkers(function() {
logger.debug('Exiting');
callback(error, report);
});
}
}