lib/index.js
function doExec(method, args) {
    var cp;
    var cpPromise = new ChildProcessPromise();
    var reject = cpPromise._cpReject;
    var resolve = cpPromise._cpResolve;

    var finalArgs = slice.call(args, 0);
    finalArgs.push(callback);

    cp = child_process[method].apply(child_process, finalArgs);

    function callback(err, stdout, stderr) {
        if (err) {
            var commandStr = args[0] + (Array.isArray(args[1]) ? (' ' + args[1].join(' ')) : '');
            err.message += ' `' + commandStr + '` (exited with error code ' + err.code + ')';
            err.stdout = stdout;
            err.stderr = stderr;
            var cpError = new ChildProcessError(err.message, err.code, child_process, stdout, stderr);
            reject(cpError);
        } else {
            resolve({
                childProcess: cp,
                stdout: stdout,
                stderr: stderr
            });
        }
    }

    cpPromise.childProcess = cp;

    return cpPromise;
}
function doExec(method, args) {
    var cp;
    var cpPromise = new ChildProcessPromise();
    var reject = cpPromise._cpReject;
    var resolve = cpPromise._cpResolve;

    var finalArgs = slice.call(args, 0);
    finalArgs.push(callback);

    cp = child_process[method].apply(child_process, finalArgs);

    function callback(err, stdout, stderr) {
        if (err) {
            var commandStr = args[0] + (Array.isArray(args[1]) ? (' ' + args[1].join(' ')) : '');
            err.message += ' `' + commandStr + '` (exited with error code ' + err.code + ')';
            err.stdout = stdout;
            err.stderr = stderr;
            var cpError = new ChildProcessError(err.message, err.code, child_process, stdout, stderr);
            reject(cpError);
        } else {
            resolve({
                childProcess: cp,
                stdout: stdout,
                stderr: stderr
            });
        }
    }

    cpPromise.childProcess = cp;

    return cpPromise;
}
Promise wrapper for exec, execFile

@param {String} method
@param {...*} args
@return {Promise}