<commit_before>'use strict';

var _ = require('underscore');
var child_process = require('child_process');
var herit = require('herit');

module.exports = herit({
  state: 'dead',

  constructor: function (command, options) {
    this.command = command;
    _.extend(this, options);
    this.spawn();
    if (this.restart !== '-') this.enableRestart();
  },

  spawn: function (event, path) {
    if (!this.isDead()) {
      if (this.isAlive()) this.kill();
      return;
    }

    var child = this.child = child_process.exec(this.command, {
      env: {
        EVENT: event,
        FILE: path
      }
    });
    this.state = 'alive';
    this.log.info(this.command, 'Spawning...');
    child.on('error', _.bind(this.onError, this));<commit_msg>Don't clobber existing env when adding EVENT and FILE<commit_after>'use strict';

var _ = require('underscore');
var child_process = require('child_process');
var herit = require('herit');

module.exports = herit({
  state: 'dead',

  constructor: function (command, options) {
    this.command = command;
    _.extend(this, options);
    this.spawn();
    if (this.restart !== '-') this.enableRestart();
  },

  spawn: function (event, path) {
    if (!this.isDead()) {
      if (this.isAlive()) this.kill();
      return;
    }

    var env = _.defaults({}, process.env, {EVENT: event, FILE: path});
    var child = this.child = child_process.exec(this.command, {env: env});
    this.state = 'alive';
    this.log.info(this.command, 'Spawning...');
    child.on('error', _.bind(this.onError, this));
{'fraction_non_alphanumeric': 0.17870967741935484, 'fraction_numerical': 0.0, 'mean_word_length': 3.226158038147139, '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': '2828213', 'n_tokens_mistral': 513, 'n_tokens_neox': 503, 'n_words': 116}