diff --git a/src/index.js b/src/index.js index 8bbdfee..b827987 100644 --- a/src/index.js +++ b/src/index.js @@ -34,16 +34,24 @@ export async function init(options = {}) { const headless = options.headless ?? isHeadless; cli.blank(); startWaiting("Checking if Farm Control Server is running...", logger); + const isCommandLines = otpCode != undefined || isInfo == true; let runningServer; try { runningServer = await checkRunning(); await stopWaiting(); + if (runningServer == false && isCommandLines == true) { + cli.failure("Farm Control Server is not running."); + cli.blank(); + return false; + } } catch (err) { await stopWaiting(); - throw err; + cli.failure("Failed to check if Farm Control Server is running:", err); + cli.blank(); + return false; } - if (otpCode != undefined || isInfo == true) { + if (isCommandLines == true) { cli.success("Farm Control Server is running."); }