From 18b2584728c3b6c31ef552b58b758c8e87ae5213 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 28 Jun 2018 03:46:54 -0600 Subject: [PATCH] make 'press any key' last --- bin/telebit.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/bin/telebit.js b/bin/telebit.js index 74dfa80..94f0199 100755 --- a/bin/telebit.js +++ b/bin/telebit.js @@ -561,18 +561,20 @@ function parseConfig(err, text) { // need just a little time to let the grants occur setTimeout(function () { - utils.putConfig('list', []); - - // workaround for https://github.com/nodejs/node/issues/21319 - if (answers._useTty) { - console.log(); - console.log("Press any key to continue..."); - console.log(); - setTimeout(function () { - process.exit(0); - }, 2 * 1000); - } - // end workaround + utils.putConfig('list', [], function (err) { + if (err) { console.error(err); return; } + console.log("Success"); + // workaround for https://github.com/nodejs/node/issues/21319 + if (answers._useTty) { + setTimeout(function () { + console.log(); + console.log("Press any key to continue..."); + console.log(); + process.exit(0); + }, 0.5 * 1000); + } + // end workaround + }); }, 1 * 1000); });