node.js - npm cli with co/yield not ending -


i'm attempting write node cli application. works, however, doesn't return command line (at least not in windows, haven't tried yet in bash). have ctrl+break out of application.

#!/usr/bin/env node --harmony  var chalk = require('chalk'); var co = require('co'); var prompt = require('co-prompt'); var program = require('commander');  program     .version('1.0.0')     .option('-w, --workshop <workshop number>', 'workshop number build')     .parse(process.argv);  co(function* () {     if (!program.workshop) {         program.workshop = yield prompt('workshop: ');     }      return yield promise.resolve(true); }).then(function() {     console.log(chalk.bold.cyan('you entered: ') + program.workshop); }); 

i've tried without line return yield promise.resolve(true); has no affect.

any suggestions?

thanks.

for interested... i'm not sure if right way, but:

  1. i ended removing

    return yield promise.resolve(true);

  2. then adding last line of .then function

    process.exit(0);

again, not sure if best approach, work.


Comments