cp-sugar
Some sugar for child_process module.
Last updated 6 years ago by inikulin .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install cp-sugar 
SYNC missed versions from official npm registry.

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)

Current Tags

  • 1.0.1                                ...           latest (6 years ago)

2 Versions

  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (4)
Dev Dependencies (4)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |