diff --git a/lib/cli/keygen.js b/lib/cli/keygen.js index 7d01bd4..29a5471 100644 --- a/lib/cli/keygen.js +++ b/lib/cli/keygen.js @@ -11,6 +11,7 @@ const keygen = function () { keys.create((err, key) => { if (err) return console.error(err); console.log('created key', `${key.substr(0, 16)}...`); + return true; }); }; diff --git a/lib/cli/showkey.js b/lib/cli/showkey.js index 8162d94..555ed4d 100644 --- a/lib/cli/showkey.js +++ b/lib/cli/showkey.js @@ -16,12 +16,13 @@ const showkey = function () { console.log(); console.log('dpd keygen'); console.log(); - return; + return true; } console.log('Copy this key for use in remote dashboard'); console.log(); console.log(key); console.log(); + return true; }); }; diff --git a/lib/cli/start.js b/lib/cli/start.js index cf52e6d..3aa5d43 100644 --- a/lib/cli/start.js +++ b/lib/cli/start.js @@ -71,10 +71,12 @@ const start = function (file) { console.info('listening on port', options.port); const commands = repl(dpd); if (program.dashboard) { - commands.dashboard(); + return commands.dashboard(); } else if (program.open) { - commands.open(); + return commands.open(); } + + return true; } function onError(err2) { @@ -91,18 +93,22 @@ const start = function (file) { dpd.on('error', onError); dpd.listen(); } else { - process.exit(); + return process.exit(); } } else { console.error(err2); - process.exit(); + return process.exit(); } + + return true; } dpd.on('listening', onListening); dpd.on('error', onError); dpd.listen(); dpd.deploydPath = program.deploydPath; + + return true; } diff --git a/lib/keys.js b/lib/keys.js index 1e089ca..72281e4 100644 --- a/lib/keys.js +++ b/lib/keys.js @@ -44,8 +44,9 @@ Keys.prototype.create = function (fn) { const fileData = data; fileData[key] = true; - keys.writeFile(fileData, (errW) => { - fn(errW, key); + return keys.writeFile(fileData, (errW) => { + if (errW) return fn(errW); + return fn(errW, key); }); }); }; @@ -95,9 +96,8 @@ Keys.prototype.getLocal = function (fn) { this.readFile((err, data) => { if (err) return fn(err); if (data && typeof data === 'object') { - fn(null, Object.keys(data)[0]); - } else { - fn(); + return fn(null, Object.keys(data)[0]); } + return fn(); }); };