The REPL waits for promise completion.

This commit is contained in:
Julien Fontanet 2015-04-21 17:17:00 +02:00
parent c1db993b92
commit 99694161e1

View File

@ -34,6 +34,15 @@ function main (args) {
var repl = createRepl({})
repl.context.xo = xo
// Make the REPL waits for promise completion.
var evaluate = Bluebird.promisify(repl.eval)
repl.eval = function (cmd, context, filename, cb) {
evaluate(cmd, context, filename)
// See https://github.com/petkaantonov/bluebird/issues/594
.then(function (result) { return result})
.nodeify(cb)
}
return eventToPromise(repl, 'exit')
})
}