Skip to content

Executes a command line string using child_process.exec under the covers, wrapped in a bluebird promise for convenience.

License

Notifications You must be signed in to change notification settings

chmontgomery/exec-promise

Repository files navigation

exec-promise NPM version Build Status

Executes a command line string using child_process.exec under the covers, wrapped in a bluebird promise for convenience.

Install

$ npm install --save @chmontgomery/exec-promise

Usage

var execPromise = require('@chmontgomery/exec-promise');

execPromise('ls -l')
  .then(function(stdout, stderr) { // can inspect output if desired
    console.log('done!');
  })
  .catch(function(err) {
    throw err;
  });
  
/*
total 16
-rw-r--r--  1 montgomeryc  staff  162 Apr 24 14:40 index.js
drwxr-xr-x  3 montgomeryc  staff  102 Apr 24 14:40 node_modules
-rw-r--r--  1 montgomeryc  staff  271 Apr 24 14:40 package.json
done!
 */

API

execPromise(cmd[,options])

cmd

Required
Type: string

Command line to execute

options

Type: object
Default: null

The node.js child_process.exec options object

License

MIT © Chris Montgomery

About

Executes a command line string using child_process.exec under the covers, wrapped in a bluebird promise for convenience.

Resources

License

Stars

Watchers

Forks

Packages

No packages published