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; }); };