2.2.1 • Published 8 years ago

child-process-promise v2.2.1

Weekly downloads
325,161
License
MIT
Repository
github
Last release
8 years ago

child-process-promise

Build Status NPM Downloads

Simple wrapper around the child_process module that makes use of promises

Installation

npm install child-process-promise --save

Usage

exec

var exec = require('child-process-promise').exec;

exec('echo hello')
    .then(function (result) {
        var stdout = result.stdout;
        var stderr = result.stderr;
        console.log('stdout: ', stdout);
        console.log('stderr: ', stderr);
    })
    .catch(function (err) {
        console.error('ERROR: ', err);
    });

spawn

var spawn = require('child-process-promise').spawn;

var promise = spawn('echo', ['hello']);

var childProcess = promise.childProcess;

console.log('[spawn] childProcess.pid: ', childProcess.pid);
childProcess.stdout.on('data', function (data) {
    console.log('[spawn] stdout: ', data.toString());
});
childProcess.stderr.on('data', function (data) {
    console.log('[spawn] stderr: ', data.toString());
});

promise.then(function () {
        console.log('[spawn] done!');
    })
    .catch(function (err) {
        console.error('[spawn] ERROR: ', err);
    });

Options

capture

Type: Array
Default: []

Pass an additional capture option to buffer the result of stdout and/or stderr

var spawn = require('child-process-promise').spawn;

spawn('echo', ['hello'], { capture: [ 'stdout', 'stderr' ]})
    .then(function (result) {
        console.log('[spawn] stdout: ', result.stdout.toString());
    })
    .catch(function (err) {
        console.error('[spawn] stderr: ', err.stderr);
    });
fns-gmefrontforcephabistateless-dev@jatin_ranka/custom-command@gongt/jspm-server@d.shmaliuk/git-bumpkpx@lyrod/electron-angular-cli@handoff/exporter@jessitron/automation-client@lyrod-cli/commandscurrencypayocrgitlab-automatorsfdx-feature-enablerremotedebug-ios-webkit-adapter-mod@vestfi/detox-expo-helpers@tasky/corepypi-releasegrade-dot-testdnpm-clihephestusteasim-scriptsspork-cliwsv-sfdx-pluginssuper-rest-apiwebsite-saber@infinitebrahmanuniverse/nolb-chilnvd-clisfpowerkit@everything-registry/sub-chunk-1320tw-obfusnode-git-detailssystemctlsystemctl-cmdsysctlxsystem-agent-coretagged-versionstennu-respondterrahubwirelesserwilwkhtmltox-promisewilsvue-git-info-jsonvue-git-info-json-examplewacoqwacoq-binwebappatronweex-templateworona-packageswpa-supplicant-confx264-npmxcode-devteam-managementwyf-all-cliwyliolabspice-js-clisteamcmdsvg-to-exporeacttexei-sfdx-plugintexhubvoxa-polly-renderervdr-testvariety-clivideo-thumbnailvoila-clivoila-servicevsc-base@docomodigital/pdor@drubin/garden-cli@cobalt-engine/install@cobalt-engine/scaffolding@cobalt-engine/slush-cobalt@cs125/personable@cs125/shareable@commonshost/core@commonshost/edge@curiostack/cloudbuild-github@corevo/docker-compose-tool@d.shmaliuk/git-bump-cli@deg-skeletor/orko@desynit/dsy-sfdx-plugins@calibur/skr-cli@brakebein/pdf2png@beisen/storybook-core@payzen/docker-compose-tool@rawqing/mdetox@ruddell/detox-expo-helpersjira-precommit-hookjive-angularjirascopejaidjae-bradley-cli-creatorjae-bradley-npm-package-creator-cliiwmanissuerjsonapi-mockjs-utils-newjscoqkarma-cordova-launcher
2.2.1

8 years ago

2.2.0

9 years ago

2.1.3

9 years ago

2.1.2

9 years ago

2.1.1

9 years ago

2.1.0

9 years ago

2.0.3

9 years ago

2.0.2

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.1.0

10 years ago

1.0.2

10 years ago

1.0.1

11 years ago

1.0.0

11 years ago

0.1.3

11 years ago

0.1.1

12 years ago

0.1.0

12 years ago