Bluebird Promise.map child_process.execFile - read output from callback -


i brand new bluebird , trying instantiate multiple child_process.execfile's using promise.map , read/combine of stdout @ completion. right now, in order execute 1 execfile , read error, stdout, , stderr this:

child_process.execfile("node", [ script, 1 ], function (error, stdout, stderr) {     ... }); 

i can achieve same thing block of code here

var promise = require('bluebird'); var execfile = require('child_process').execfile; execfile = promise.promisify(execfile); var print = "print.js";  execfile("node", [ script, 1 ]).then( function (stdout) {     console.log(stdout); }, function (stderr) {     console.log(stderr); }); 

when attempt using bluebird , map, modeling it, more or less, around this example. want take example above , able call multiple command line arguments, this:

arr = [1,2,3,4,5,6] promise.map(arr, function(i) {     return execfile("node", [ script, 1 ]) }).then( function (array_of_all_stdout) {     console.log(array_of_all_stdout); }, function (array_of_all_stderr) {     console.log(array_of_all_stderr); }); 

i feel close, cannot find way read returned values map. please point me in right direction?


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -