exec-then

1.3.1 • Public • Published

NPM version Build Status Dependency Status

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

Package Sidebar

Install

npm i exec-then

Weekly Downloads

60

Version

1.3.1

License

MIT

Last publish

Collaborators

  • ragingwind