<commit_before>var util = require('util')
  , exec = require("child_process").exec
  , Fiber = require('fibers')
  , Future = require('fibers/future')
  , Transport = require('./index');

function ShellTransport(flight) {
  ShellTransport.super_.call(this, flight);
  this.target.host = 'localhost';
  this.logger = this.logger.cloneWithPrefix(this.target.host);
}

util.inherits(ShellTransport, Transport);

ShellTransport.prototype.__exec = function(cmd, args, options) {
  var fiber = Fiber.current;
  var proc = null;
  var ret = {
    code: 0,
    stdout: null,
    stderr: null
  };
  cmd = (cmd !== 'sudo') ? this._execWith + cmd : cmd;
  cmd = cmd + (args ? ' ' + args : '');
  this.logger.command(cmd);
  proc = exec(cmd);

  proc.stdout.on('data', function(data) {
    ret.stdout = (ret.stdout || '') + data;
    if(!options.silent) {
      this.logger.stdout(String(data));
    }
  }.bind(this));

  proc.stderr.on('data', function(data) {
    ret.stderr += data;
    (options.failsafe ? this.logger.stdwarn : this.logger.stderr)(String(data));
  }.bind(this));

  proc.on('close', function(code) {
    ret.code = code;
    if(ret.code === 0) {
      this.logger.success('ok'.success);<commit_msg>Allows anyone to pass in options to the exec() command to do things like increasing the maxBuffer for stdout<commit_after>var util = require('util')
  , exec = require("child_process").exec
  , Fiber = require('fibers')
  , Future = require('fibers/future')
  , Transport = require('./index');

function ShellTransport(flight) {
  ShellTransport.super_.call(this, flight);
  this.target.host = 'localhost';
  this.logger = this.logger.cloneWithPrefix(this.target.host);
}

util.inherits(ShellTransport, Transport);

ShellTransport.prototype.__exec = function(cmd, args, options) {
  var fiber = Fiber.current;
  var proc = null;
  var ret = {
    code: 0,
    stdout: null,
    stderr: null
  };
  cmd = (cmd !== 'sudo') ? this._execWith + cmd : cmd;
  cmd = cmd + (args ? ' ' + args : '');
  this.logger.command(cmd);
  proc = exec(cmd, options.execOptions || {});

  proc.stdout.on('data', function(data) {
    ret.stdout = (ret.stdout || '') + data;
    if(!options.silent) {
      this.logger.stdout(String(data));
    }
  }.bind(this));

  proc.stderr.on('data', function(data) {
    ret.stderr += data;
    (options.failsafe ? this.logger.stdwarn : this.logger.stderr)(String(data));
  }.bind(this));

  proc.on('close', function(code) {
    ret.code = code;
    if(ret.code === 0) {
      this.logger.success('ok'.success);
{'fraction_non_alphanumeric': 0.1773049645390071, 'fraction_numerical': 0.0015760441292356187, 'mean_word_length': 3.607985480943739, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4114069', 'n_tokens_mistral': 864, 'n_tokens_neox': 831, 'n_words': 168}