From e670de09aead3e8d69ba03b4639dfb62a277d1e6 Mon Sep 17 00:00:00 2001 From: pbca26 Date: Sat, 21 Oct 2017 13:26:47 +0300 Subject: [PATCH] addcoin bug fix --- routes/shepherd/daemonControl.js | 22 ++++++++++++---------- routes/shepherd/quitDaemon.js | 15 +++++---------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/routes/shepherd/daemonControl.js b/routes/shepherd/daemonControl.js index aa0b7ad..29cf545 100644 --- a/routes/shepherd/daemonControl.js +++ b/routes/shepherd/daemonControl.js @@ -11,16 +11,18 @@ module.exports = (shepherd) => { shepherd.log(`getconf coind ${coind}`); shepherd.writeLog(`getconf flock: ${flock}`); - switch (shepherd.os.platform()) { - case 'darwin': - nativeCoindDir = `${process.env.HOME}/Library/Application Support/${shepherd.nativeCoindList[coind.toLowerCase()].bin}`; - break; - case 'linux': - nativeCoindDir = coind ? `${process.env.HOME}/.${shepherd.nativeCoindList[coind.toLowerCase()].bin.toLowerCase()}` : null; - break; - case 'win32': - nativeCoindDir = coind ? `${process.env.APPDATA}/${shepherd.nativeCoindList[coind.toLowerCase()].bin}` : null; - break; + if (coind) { + switch (shepherd.os.platform()) { + case 'darwin': + nativeCoindDir = `${process.env.HOME}/Library/Application Support/${shepherd.nativeCoindList[coind.toLowerCase()].bin}`; + break; + case 'linux': + nativeCoindDir = coind ? `${process.env.HOME}/.${shepherd.nativeCoindList[coind.toLowerCase()].bin.toLowerCase()}` : null; + break; + case 'win32': + nativeCoindDir = coind ? `${process.env.APPDATA}/${shepherd.nativeCoindList[coind.toLowerCase()].bin}` : null; + break; + } } switch (flock) { diff --git a/routes/shepherd/quitDaemon.js b/routes/shepherd/quitDaemon.js index 70acb9b..c0ca981 100644 --- a/routes/shepherd/quitDaemon.js +++ b/routes/shepherd/quitDaemon.js @@ -19,7 +19,8 @@ module.exports = (shepherd) => { const execCliStop = () => { let _arg = []; - if (chain && !shepherd.nativeCoindList[key.toLowerCase()] && key !== 'CHIPS') { + if (chain && + !shepherd.nativeCoindList[key.toLowerCase()] && key !== 'CHIPS') { _arg.push(`-ac_name=${chain}`); if (shepherd.appConfig.dataDir.length) { @@ -59,15 +60,9 @@ module.exports = (shepherd) => { shepherd.log(`exec error: ${error}`); } - if (key === 'CHIPS') { - setTimeout(() => { - shepherd.killRogueProcess('chips-cli'); - }, 100); - } else { - setTimeout(() => { - shepherd.killRogueProcess('komodo-cli'); - }, 100); - } + setTimeout(() => { + shepherd.killRogueProcess(key === 'CHIPS' ? 'chips-cli' : 'komodo-cli'); + }, 100); }); }