easy-spawn

Utilities that make it easier to write child_process.spawn programmes

easy-spawn

Utilities that make it easier to write child_process.spawn programmes.

  • Easy to use
  • Standard callback with err and data

Below are some examples of how to work with easy-spawn, you can find more examples under the /test/ directory

var Spawn = require('easy-spawn');
 
spawn = new Spawn({
    cwd: '/working directory where you want to ran command',
});
 
spawn.cmd('ls', function(errdata) {
   console.log(data); 
});
 
spawn.cmd(['ls', '-l', '/var/log'], function(errdata) {
    console.log(data);
});
var Spawn = require('easy-spawn');
 
spawn = new Spawn();
spawn.cmd(['git', '--version'], function(errdata) {
   console.log(data); // git version 1.7.xxx  
});
npm install easy-spawn