I am using the node.js libraries nomnom for command line parsing and bluebird's promises.
Nomnom offers to execute commands via a callback. Unfortunately, the callback doesn't support returning promises.
I was wondering, what is the best way to handle this interface mismatch? I was thinking adding a busy loop that blocks until a promise is resolved / rejected (using isPending ) in this case. Is there a better way ?
var parser = require("nomnom");
parser.command('somecommand').callback(function(opts) {
var p = thisFuncReturnsAPromise();
//have to block here since
//nomnom expects at the end of the callback that processing of the command is done.
})