diff --git a/bin.js b/bin.js index 1e4a613..5921141 100755 --- a/bin.js +++ b/bin.js @@ -14,10 +14,11 @@ var argv = require('yargs') .help('h') .argv; -require('./lib/cli').run(argv, function (err) { +require('./lib/cli').run(argv, function (err, res) { if (err) { console.error('symlink:', err.message); process.exit(1); } + //console.log(res) process.exit(0); }); diff --git a/lib/cli.js b/lib/cli.js index 381dbee..b8ac695 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -4,23 +4,15 @@ var async = require('async'); var dryRunHandler = function (cmds, done) { console.log(JSON.stringify(cmds, null, " ")); - done(); + done(null); }; var executeHandler = function (cmds, done) { - // create one cp function cmd that execs and cbs to next in async series - var execs = cmds.map(function (cmd) { - return function (cb) { - console.log(cmd); // npm link xs && npm install ys && npm link - cp.exec(cmd, function (error, stdout) { - console.log(stdout); - cb(error); - }); - }; - }); - - // exec commands synchronously - async.series(execs, done); + var iterator = function (cmd, cb) { + console.log(cmd); + cp.exec(cmd, cb); + }; + async.mapSeries(cmds, iterator, done); }; exports.run = function (argv, done) {