MXS-1300: Resolved the promise for help commands

The promise returned by the `execute` MaxCtrl library function is now
properly resolved also for `help` type commands.
This commit is contained in:
Markus Mäkelä
2017-08-07 08:37:51 +03:00
parent 527ada770c
commit 9a04dd0311
3 changed files with 14 additions and 10 deletions

View File

@ -15,6 +15,12 @@
var maxctrl = require('./lib/core.js')
function print(out) {
if (out) {
console.log(out)
}
}
// Mangle the arguments if we are being called from the command line
if (process.argv[0] == process.execPath) {
process.argv.shift()
@ -23,12 +29,4 @@ if (process.argv[0] == process.execPath) {
}
maxctrl.execute(process.argv)
.then(function(out) {
if (out) {
console.log(out)
}
}, function(out) {
if (out) {
console.log(out)
}
})
.then(print, print)