Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (21 sloc) 0.508 kb

command

A Node.js chainable, promise-based utility for running commands with child_process.spawn

Install

$ npm install command

Usage

var command = require('command');

command.open('/some/directory/path')
    .on('stdout', command.writeTo(process.stdout))
    .on('stderr', command.writeTo(process.stderr))
    .chdir('..')
    .exec('ls')
    .then(function() {
        var stdout = this.lastOutput.stdout;
        if (! stdout.trim().length) {
            console.warn('No files found!');
        }
    });
Jump to Line
Something went wrong with that request. Please try again.