<commit_before>const fse = require('fs-extra');
const path = require('path');
const {spawnSync} = require('child_process');

/**
  * pipenv install
  * @return {Promise}
  */
function pipfileToRequirements() {
  if (!this.options.usePipenv || !fse.existsSync(path.join(this.servicePath, 'Pipfile')))
    return;

  this.serverless.cli.log('Generating requirements.txt from Pipfile...');

  const res = spawnSync('pipenv', ['lock', '--requirements'], {cwd: this.servicePath});
  if (res.error) {
    if (res.error.code === 'ENOENT')
      throw new Error(`pipenv not found! Install it with 'pip install pipenv'.`);
    throw new Error(res.error);
  }
  if (res.status != 0)
    throw new Error(res.stderr);
  fse.ensureDir(path.join(this.servicePath, '.serverless'));
  fse.writeFileSync(path.join(this.servicePath, '.serverless/requirements.txt'), res.stdout);
};

module.exports = {pipfileToRequirements};<commit_msg>Fix minor bug in #92<commit_after>const fse = require('fs-extra');
const path = require('path');
const {spawnSync} = require('child_process');

/**
  * pipenv install
  * @return {Promise}
  */
function pipfileToRequirements() {
  if (!this.options.usePipenv || !fse.existsSync(path.join(this.servicePath, 'Pipfile')))
    return;

  this.serverless.cli.log('Generating requirements.txt from Pipfile...');

  const res = spawnSync('pipenv', ['lock', '--requirements'], {cwd: this.servicePath});
  if (res.error) {
    if (res.error.code === 'ENOENT')
      throw new Error(`pipenv not found! Install it with 'pip install pipenv'.`);
    throw new Error(res.error);
  }
  if (res.status != 0)
    throw new Error(res.stderr);
  fse.ensureDirSync(path.join(this.servicePath, '.serverless'));
  fse.writeFileSync(path.join(this.servicePath, '.serverless/requirements.txt'), res.stdout);
};

module.exports = {pipfileToRequirements};
{'fraction_non_alphanumeric': 0.17379534380075798, 'fraction_numerical': 0.002165674066053059, 'mean_word_length': 4.5830815709969785, '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': '1299200', 'n_tokens_mistral': 626, 'n_tokens_neox': 612, 'n_words': 129}