Explicitly mention if netstat isn't installed; downgrade to warning

This commit is contained in:
Asher 2019-04-08 11:14:43 -05:00
parent 6361635b55
commit bbd8b27fc7
No known key found for this signature in database
GPG Key ID: 7BB4BA9C783D2BBC

View File

@ -79,7 +79,11 @@ export const createPortScanner = (scanInterval: number = 5000): PortScanner => {
logger.trace("scanning ports"); logger.trace("scanning ports");
scan((error) => { scan((error) => {
if (error) { if (error) {
logger.error(`Port scanning will not be available: ${error.message}.`); if ((error as NodeJS.ErrnoException).code === "ENOENT") {
logger.warn("Port scanning will not be available because netstat is not installed");
} else {
logger.warn(`Port scanning will not be available: ${error.message}`);
}
disposed = true; disposed = true;
} else if (!disposed) { } else if (!disposed) {
lastTimeout = setTimeout(doInterval, scanInterval); lastTimeout = setTimeout(doInterval, scanInterval);