From 7c142aa4ddbe0415eb734520e52af689dd685991 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Thu, 16 Sep 2021 17:11:16 -0400 Subject: [PATCH] gun subprocess now checks its death --- utils/GunSmith/gun.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/utils/GunSmith/gun.js b/utils/GunSmith/gun.js index 0f99a745..983a8837 100644 --- a/utils/GunSmith/gun.js +++ b/utils/GunSmith/gun.js @@ -65,10 +65,21 @@ const waitForAuth = async () => { return waitForAuth() } +let dead = false + /** * @param {Smith.SmithMsg} msg */ const handleMsg = async msg => { + if (dead) { + logger.error('Dead sub-process received msg: ', msg) + return + } + // @ts-ignore + if (msg === 'bye') { + logger.info('KILLING') + dead = true + } if (Array.isArray(msg)) { msg.forEach(handleMsg) return