Home

Awesome

exec-extra

NPM version Travis AppVeyor Codecov David

child_process with POSIX style features.

Why

Install

npm install --save exec-extra

Usage

const exec = require('exec-extra');
exec('cat', ['README.md']).then((stdout) => {
  console.info('Success!')
  console.info('stdout:', stdout.toString())
})
.catch((error) => {
  console.error('Failed!')
  console.error('exit status:', error.exitStatus)
  console.error('stderr:', error.stderr.toString())
})

Or use child_process

require('exec-extra');
const spawn = require('child_process').spawn;
const ls = spawn('eslint', ['test/*.js']);

ls.stdout.on('data', (data) => {
  console.log(`stdout: ${data}`);
});

ls.stderr.on('data', (data) => {
  console.log(`stderr: ${data}`);
});

ls.on('close', (code) => {
  console.log(`child process exited with code ${code}`);
});

Or use CLI

npm i -g exec-extra

Methods