Smart wrapper around child_process.spawn using promises.
var spawned = require('spawned');
spawned('echo', ['test'])
.then(function(proc) {
console.log("Did it work? " + ((proc.out.match(/test/))? "yes" : "no"));
})
.catch(function(err) {
console.log("Boooooom");
console.error(err.err);
});Spawn a new process and returns a promise.
command:Stringthe command to executeargs:Arraya list of arguments to pass to the commandoptions:Objectinherits the options from child_process.spawn plus these:- out: A
WriteableStreamreceiving thestdoutdata - err: A
WriteableStreamreceiving thestderrdata
- out: A
Returns a promise which:
- when fullfilled resolves to an object like:
err:Stringcontainingstderrout:Stringcontainigstdoutcombined:Stringcontaining the intermingled contents ofstdoutandstderrcode:Numberthe return code of the program
- when rejected resolves to an
Errorhaving the same properties as above.



