@chmontgomery/exec-promise

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

Usage no npm install needed!

<script type="module">
  import chmontgomeryExecPromise from 'https://cdn.skypack.dev/@chmontgomery/exec-promise';
</script>

README

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 exec-promise

Usage

var execPromise = require('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