<commit_before>const ps = require('ps-node');
const commandExists = require('command-exists');
const commandExistsSync = require('command-exists').sync;

module.exports = {
  isDockerComposeInstalledSync() {
    return commandExistsSync('docker-compose');
  },

  isDockerComposeInstalled(cb) {
    commandExists('docker-compose', cb);
  },

  isDockerCliInstalledSync() {
    return commandExistsSync('docker');
  },

  isDockerCliInstalled(cb) {
    commandExists('docker', cb);
  },

  isDockerEngineRunning(cb) {

    var IS_WIN = process.platform === 'win32';

    if (IS_WIN) {
      ps_options = { command: 'docker' };
    } else {
      ps_options = { command: 'dockerd', psargs: 'aux' };
    }

    ps.lookup(ps_options, (err, resultList) => {
      if (err) cb(err);
      else if (resultList.length === 0)
        { cb(null, false); }
      else cb(null, true);
    });

  },
};<commit_msg>Added Docker engine check via "docker ps" command<commit_after>const ps = require('ps-node');
const commandExists = require('command-exists');
const commandExistsSync = require('command-exists').sync;
const cmd = require('node-cmd');

module.exports = {
  isDockerComposeInstalledSync() {
    return commandExistsSync('docker-compose');
  },

  isDockerComposeInstalled(cb) {
    commandExists('docker-compose', cb);
  },

  isDockerCliInstalledSync() {
    return commandExistsSync('docker');
  },

  isDockerCliInstalled(cb) {
    commandExists('docker', cb);
  },

  isDockerEngineRunning(cb) {

    var IS_WIN = process.platform === 'win32';

    if (IS_WIN) {
      ps_options = { command: 'docker' };
    } else {
      ps_options = { command: 'dockerd', psargs: 'aux' };
    }

    ps.lookup(ps_options, (err, resultList) => {

      if (err) {
        cb(err);

      } else if (resultList.length === 0) {

        cmd.run('docker').on('exit', code => {
          if (code > 0) {
            cb(null, false);
          } else {
            cb(null, true);
          }
        });

      } else {
        cb(null, true);
      }

    });

  },
};
{'fraction_non_alphanumeric': 0.1596884128529698, 'fraction_numerical': 0.0034079844206426485, 'mean_word_length': 2.8773584905660377, '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': '6468737', 'n_tokens_mistral': 706, 'n_tokens_neox': 660, 'n_words': 124}