lib/common/child-process.js
function ChildProcess (command, args, env, code, maxBuffer) {
        var self = this;

        assert.string(command);
        assert.optionalArrayOfNumber(code);

        self.command = command;
        self.file = self._parseCommandPath(self.command);
        self.args = args;
        self.environment = env || {};
        self.exitCode = code || [0];
        self.maxBuffer = maxBuffer || Constants.ChildProcess.MaxBuffer;

        if (!self.file) {
            throw new Error('Unable to locate command file (' + self.command +').');
        }
        if (!_.isEmpty(self.args)) {
            try {
                assert.arrayOfString(self.args, 'ChildProcess command arguments');
            } catch (e) {
                throw new Error('args must be an array of strings');
            }
        }

        self.hasBeenKilled = false;
        self.hasBeenCancelled = false;
        self.spawnInstance = undefined;
    }
function ChildProcess (command, args, env, code, maxBuffer) {
        var self = this;

        assert.string(command);
        assert.optionalArrayOfNumber(code);

        self.command = command;
        self.file = self._parseCommandPath(self.command);
        self.args = args;
        self.environment = env || {};
        self.exitCode = code || [0];
        self.maxBuffer = maxBuffer || Constants.ChildProcess.MaxBuffer;

        if (!self.file) {
            throw new Error('Unable to locate command file (' + self.command +').');
        }
        if (!_.isEmpty(self.args)) {
            try {
                assert.arrayOfString(self.args, 'ChildProcess command arguments');
            } catch (e) {
                throw new Error('args must be an array of strings');
            }
        }

        self.hasBeenKilled = false;
        self.hasBeenCancelled = false;
        self.spawnInstance = undefined;
    }
function ChildProcess ( command , args , env , code , maxBuffer ) { var self = this ; assert . string ( command ) ; assert . optionalArrayOfNumber ( code ) ; self . command = command ; self . file = self . _parseCommandPath ( self . command ) ; self . args = args ; self . environment = env || { } ; self . exitCode = code || [ 0 ] ; self . maxBuffer = maxBuffer || Constants . ChildProcess . MaxBuffer ; if ( ! self . file ) { throw new Error ( 'Unable to locate command file (' + self . command + ').' ) ; } if ( ! _ . isEmpty ( self . args ) ) { try { assert . arrayOfString ( self . args , 'ChildProcess command arguments' ) ; } catch ( e ) { throw new Error ( 'args must be an array of strings' ) ; } } self . hasBeenKilled = false ; self . hasBeenCancelled = false ; self . spawnInstance = undefined ; }
ChildProcess provides a promise based mechanism to run shell commands
in a fairly secure manner.
@constructor
ChildProcess provides a promise based mechanism to run shell commands in a fairly secure manner .