exec-then

Child process execute with promise, deferred

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
exec-then
401.3.18 years ago8 years agoMinified + gzip package size for exec-then in KB

Readme

Child process execute with promise, deferred

Install

$ npm install --save exec-then

Usage

var exec = require('exec-then');

exec('pwd').then(function(res) {
  assert(res.stdout.indexOf(path.resolve(__dirname, '../')) !== -1);
}, function(err) {
  console.log(err.toString());
  assert(false);
});

exec(['ls', '-al'], function(std, deferred) {
  if (std.stdout.indexOf('test') === -1) {
    return deferred.reject();
  }
  return true;
}).then(function(res) {
  if (res) {
    console.log('You have test file');
  }
}, function() {
  console.log('Where am I?');
});

Options

exec-node using same options to Child Process options except to options below.
  • verbose: show stdio/stderr message while child process is running. if verbose set true? child_process.spawn will be executed.

License

MIT © ragingwind