From 248640cd3e42e070b586ce721a473e786874ba7b Mon Sep 17 00:00:00 2001 From: Vasil Rangelov Date: Mon, 17 Apr 2017 00:09:23 +0300 Subject: [PATCH] Changed index.js to return a Promise that resolves to the status to return on the command line, which greenlock.js now uses when closing the process. --- bin/greenlock.js | 4 +++- index.js | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/greenlock.js b/bin/greenlock.js index 7323a9e..a0c273b 100755 --- a/bin/greenlock.js +++ b/bin/greenlock.js @@ -103,6 +103,8 @@ cli.main(function(_, options) { return; } - require('../').run(args); + require('../').run(args).then(function (status) { + process.exit(status); + }); }); }); diff --git a/index.js b/index.js index f5d3971..933aafa 100644 --- a/index.js +++ b/index.js @@ -98,7 +98,7 @@ module.exports.run = function (args) { } // Note: can't use args directly as null values will overwrite template values - le.register({ + return le.register({ debug: args.debug , email: args.email , agreeTos: args.agreeTos @@ -147,12 +147,12 @@ module.exports.run = function (args) { ); console.log(""); - process.exit(0); + return 0; }, function (err) { console.error('[Error]: greenlock-cli'); console.error(err.stack || new Error('get stack').stack); - process.exit(1); + return 1; }); };