<commit_before>const { exec, spawn } = require('child_process');

class Execute {
  static run(fullCmd) {
    return new Promise((resolve, reject) => {
    exec(fullCmd, (error, stdout, stderr) => {
      if (stderr || error) {
        reject(stderr || error);
      }
      resolve(stdout);
    });
  });
  }

  static cmd(base, params) {
    if (!params && base) {
    return base;
  }
  if (params.constructor !== Array) {
    throw new Error('params must be an Array');
  }
  
  return base + ' ' + params.join(' ');
  }
}

class Spawn {
  static run(cmd, params) {
    const child = spawn(cmd, params);
    return child;
  }
}

module.exports = {
  Execute,<commit_msg>Minor refactor of Execute.js<commit_after>const { exec, spawn } = require('child_process');

class Execute {
  static run(fullCmd) {
    return new Promise((resolve, reject) => {
      exec(fullCmd, (error, stdout, stderr) => {
        if (error) {
          console.log(`Error in exec: ${ error }`);
          // throw error;
        }

        if (stderr) {
          reject(stderr);
        }
        if (stdout) {
          resolve(stdout);
        }
      });
    });
  }

  static cmd(base, params) {
    if (!params && base) {
    return base;
  }
  if (params.constructor !== Array) {
    throw new Error('params must be an Array');
  }
  
  return base + ' ' + params.join(' ');
  }
}

class Spawn {
  static run(cmd, params) {
    return spawn(cmd, params);
  }
}

module.exports = {
  Execute,
{'fraction_non_alphanumeric': 0.15561569688768606, 'fraction_numerical': 0.0, 'mean_word_length': 2.2866666666666666, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '453675', 'n_tokens_mistral': 489, 'n_tokens_neox': 484, 'n_words': 119}