From 73bf1fe232b22f44d428ad9d9469de1ebf22c967 Mon Sep 17 00:00:00 2001 From: Victor Korkoshko Date: Sat, 16 Nov 2019 00:49:52 +0200 Subject: [PATCH] Fix debug event call after resolve (#30) --- components/handler.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/handler.js b/components/handler.js index 7d4808e..e8dd71b 100644 --- a/components/handler.js +++ b/components/handler.js @@ -21,16 +21,17 @@ class Handler { checkJava(java) { return new Promise(resolve => { child.exec(`${java} -version`, (error, stdout, stderr) => { - if(error) { + if (error) { resolve({ run: false, message: error }) + } else { + this.client.emit('debug', `[MCLC]: Using Java version ${stderr.match(/"(.*?)"/).pop()} ${stderr.includes('64-Bit') ? '64-bit': '32-Bit'}`); + resolve({ + run: true + }); } - this.client.emit('debug', `[MCLC]: Using Java version ${stderr.match(/"(.*?)"/).pop()} ${stderr.includes('64-Bit') ? '64-bit': '32-Bit'}`); - resolve({ - run: true - }); }); }); }