<commit_before>var Autowire = require('wantsit').Autowire

var CommandLine = function () {
  this._child_process = Autowire
  this._logger = Autowire
}

CommandLine.prototype._find = function (command, userDetails, callback) {
  this._child_process.exec('sudo -iu ' + userDetails.name + " 'which " + command + "'", {
    uid: userDetails.uid,
    gid: userDetails.gid,
    env: {
      USER: userDetails.name,
      HOME: userDetails.home,
      PATH: userDetails.path
    }
  }, function (error, stdout) {
      if (error) return callback(new Error('Could not find ' + command + ' in path ' + userDetails.path + ' - is it installed?'))

      var path = stdout.trim()

      callback(undefined, path)
    })
}

CommandLine.prototype.git = function (args, path, userDetails, onOut, onErr, message, callback) {
  this._find('git', userDetails, function (error, git) {
    if (error) return callback(error)<commit_msg>source profile<commit_after>var Autowire = require('wantsit').Autowire,
  util = require('util')

var CommandLine = function () {
  this._child_process = Autowire
  this._logger = Autowire
}

CommandLine.prototype._find = function (command, userDetails, callback) {
  var shell_command = util.format("sudo -iu %s '[ -f ~/.bash_profile ] && source ~/.bash_profile; [ -f ~/.profile ] && source ~/.profile; which %s'", userDetails.name, command)

  this._child_process.exec(shell_command, {
    uid: userDetails.uid,
    gid: userDetails.gid,
    env: {
      USER: userDetails.name,
      HOME: userDetails.home,
      PATH: userDetails.path
    }
  }, function (error, stdout) {
    if (error) return callback(new Error('Could not find ' + command + ' in path ' + userDetails.path + ' - is it installed?'))

    var path = stdout.trim()

    callback(undefined, path)
  })
}

CommandLine.prototype.git = function (args, path, userDetails, onOut, onErr, message, callback) {
  this._find('git', userDetails, function (error, git) {
    if (error) return callback(error)
{'fraction_non_alphanumeric': 0.13918305597579425, 'fraction_numerical': 0.0, 'mean_word_length': 3.624708624708625, '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': '3688301', 'n_tokens_mistral': 634, 'n_tokens_neox': 616, 'n_words': 157}