From 85ec9e1be7b36cce920ed96b1958c03a761a00a0 Mon Sep 17 00:00:00 2001 From: Matthew McEachen Date: Sun, 20 Oct 2024 10:11:57 -0700 Subject: [PATCH] delint --- src/mkver.spec.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/mkver.spec.ts b/src/mkver.spec.ts index ac0edcb..814909d 100644 --- a/src/mkver.spec.ts +++ b/src/mkver.spec.ts @@ -136,14 +136,15 @@ function _exec(cp: ChildProcess): Promise { // console.error("cp.on(error)", ea) rej(ea); }); - cp.on("close", (code) => { - // console.error("cp.on(close)", { code }) - code == 0 ? res(buf.join("")) : rej("bad exit code " + code); - }); - cp.on("exit", (code) => { - // console.error("cp.on(exit)", { code }) - code == 0 ? res(buf.join("")) : rej("bad exit code " + code); - }); + const callback = (code: number | null) => { + if (code == 0) { + res(buf.join("")); + } else { + rej("bad exit code " + code); + } + }; + cp.on("close", callback); + cp.on("exit", callback); }); }