Runs a command in a shell and buffers the output.
@param command {string} - The command
@param options {ExecOptions} - Options
@returns {PromiseWithEvents<ExecResult>}
@see {@link https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback}
function exec(command, options) {
    return new PromiseWithEvents_1.PromiseWithEvents(function (resolve, reject, eventEmitter) {
        var childProcess = cp.exec(command, options, function (err, stdout, stderr) {
            if (err) {
                reject(err);
            }
            else {
                resolve({
                    stdout: stdout.toString(),
                    stderr: stderr.toString()
                });
            }
        });
        process.nextTick(function () { return eventEmitter.emit('process', childProcess); });
    });
}