Add exit-handler with error-detection

This commit is contained in:
Ruakij 2021-11-29 09:16:39 +01:00
parent 3c5e941cba
commit 96b52e63a0

View File

@ -71,4 +71,16 @@ if(errorMsg){
logger.error(data);
});
logger.debug("Attaching exit-handler..");
proc.on("exit", (code) => {
logger.info(`tcpdump exited code: ${code}`);
if (code) {
logger.fatal(`tcpdump exited with non-zero code: ${code}`);
exit(1);
}
logger.info("Shutdown");
exit(0);
});
logger.info("Startup complete");
})();