That would require an `execSync` which Node doesn't have (yet). You have to do it as a callback.
On Sat, Dec 28, 2013 at 11:08 AM, [email protected] <[email protected]>wrote: > I have a 'require('child_process').exec' call that gives an anonymous > function to capture its output. What I need to do is return this output to > the calling function. > > Visually Explained: > > function -> > function that Executes Child -> > Anonymous Function -> > Return output to calling fn > > Code: > > launch: function (ProviderCommand) { > var self = this; > > this.D("Exec: " + ProviderCommand, "Launch"); > > require('child_process').exec(ProviderCommand, { > cwd: "providers" > }, > function (error, stdout, stderr) { > self.D("Out: " + stdout, "Launch"); > self.D("ERR: " + stderr, "Launch"); > if (error !== null) { > self.D("Exec Error: " + error, > "Launch"); > } > }); > }, > > Just ignore the calls to this.D(...) and self.D(...) they are just > debugging calls that write console output to my terminal... > > I'm at a loss as how to accomplish this, any help would be appreciated. > > -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
