dondreytaylor / node-exec-promise

Execute commands from Node.js and get a Promise back.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node-exec-promise

This package is a simple wrapper for child_process.exec and child_process.execFile which returns a Promise.

Installation

npm install --save node-exec-promise

Example Usage

var exec = require('node-exec-promise').exec;

exec('ls -lah /tmp').then(function(stdout) {
  console.log(stdout);
}, function(stderr) {
  console.log(stderr);
});

Example Gulp Usage

var execFile = require('node-exec-promise').execFile;

gulp.task('example', function(done) {
  execFile('ls', ['-lah', '/tmp']).then(function(stdout) {
    done();
  }, function(stderr) {
    // handle error
  });
});

About

Execute commands from Node.js and get a Promise back.

License:MIT License


Languages

Language:JavaScript 100.0%