From 3e0c97751174b03a10b36b5aa2303cf9ea5f4b76 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 25 Sep 2018 00:54:51 -0600 Subject: [PATCH] fix a few WIP parser bugs --- bin/telebit-remote.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/bin/telebit-remote.js b/bin/telebit-remote.js index 429a9c5..bb4f51f 100755 --- a/bin/telebit-remote.js +++ b/bin/telebit-remote.js @@ -328,16 +328,19 @@ function parseConfig(err, text) { console.info(verstr.join(' ')); } - if ('ENOENT' === err.code || 'ECONNREFUSED' === err.code) { - console.error("Either the telebit service was not already (and could not be started) or its socket could not be written to."); - console.error(err); - } else if ('ENOTSOCK' === err.code) { - console.error(err); + if (err) { + if ('ENOENT' === err.code || 'ECONNREFUSED' === err.code) { + console.error("Either the telebit service was not already (and could not be started) or its socket could not be written to."); + console.error(err); + } else if ('ENOTSOCK' === err.code) { + console.error(err); + return; + } else { + console.error(err); + } + process.exit(101); return; - } else { - console.error(err); } - if (err) { process.exit(101); return; } // // check for init first, before anything else @@ -428,6 +431,7 @@ function parseConfig(err, text) { RC.request({ service: argv[0], method: 'POST', data: argv.slice(1) }, handleRemoteRequest(argv[0])); return true; } + help(); return true; })) { return;