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.

This commit is contained in:
Vasil Rangelov 2017-04-17 00:09:23 +03:00
parent 9bbb3ea6b0
commit 248640cd3e
2 changed files with 6 additions and 4 deletions

View File

@ -103,6 +103,8 @@ cli.main(function(_, options) {
return; return;
} }
require('../').run(args); require('../').run(args).then(function (status) {
process.exit(status);
});
}); });
}); });

View File

@ -98,7 +98,7 @@ module.exports.run = function (args) {
} }
// Note: can't use args directly as null values will overwrite template values // Note: can't use args directly as null values will overwrite template values
le.register({ return le.register({
debug: args.debug debug: args.debug
, email: args.email , email: args.email
, agreeTos: args.agreeTos , agreeTos: args.agreeTos
@ -147,12 +147,12 @@ module.exports.run = function (args) {
); );
console.log(""); console.log("");
process.exit(0); return 0;
}, function (err) { }, function (err) {
console.error('[Error]: greenlock-cli'); console.error('[Error]: greenlock-cli');
console.error(err.stack || new Error('get stack').stack); console.error(err.stack || new Error('get stack').stack);
process.exit(1); return 1;
}); });
}; };