All Projects → inikulin → Cp Sugar

inikulin / Cp Sugar

Licence: mit
Some sugar for child_process module.

Programming Languages

javascript
184084 projects - #8 most used programming language

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 ([email protected])

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].