cp-sugar

1.0.1 • Public • Published

cp-sugar

Build Status

Some sugar for child_process module.

Install

npm install cp-sugar

API

.exec(cmd)

const exec = require('cp-sugar').exec;
 
exec('git status --porcelain')
    .then(stdout => console.log(stdout))
    .catch(err => console.log(err.message));

What's cool about it:

  • Promise-based
  • Trims stdout

.spawn(cmd, silent)

const spawn = require('cp-sugar').spawn;
 
spawn('git status --porcelain')
    .then(() => ...)
    .catch(err => console.log(err.message));

What's cool about it:

  • Promise-based
  • Accepts command string as exec instead of executable and array of args in the original implementation
  • Windows-frienldy
  • Rejects on both error and non-zero exit code
  • Has silent mode (ignore child's stdio)

Author

Ivan Nikulin (ifaaan@gmail.com)

/cp-sugar/

    Package Sidebar

    Install

    npm i cp-sugar

    Weekly Downloads

    1,394

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    4.46 kB

    Total Files

    4

    Last publish

    Collaborators

    • inikulin