<commit_before>const
  path = require('path'),
  extend = require('extend'),
  spawn = require('child_process').spawn,
  syncRequest = require('sync-request'),
  pretty = require('pretty'),
  sgUtil = require('../util'),
  ConfigManager = require('../ConfigManager');

class httpRenderEngine {

  constructor(options, root, ext) {
    this.options = options;
    this.root = root;
    this.ext = ext;

    this.startServer();
  }

  startServer() {

    const {script: {command, port = 99999, pathToScript, debug}} = this.options;

    if (command && pathToScript) {
      const args = ['-S', `0.0.0.0:${port}`, '-t', pathToScript];

      this.childProcess = spawn(this.options.script.command, args, {stdio: 'pipe', detached: false});

      sgUtil.log(`[✓] ${this.constructor.name}: server started (pid: ${this.childProcess.pid})`, 'info');
      sgUtil.log(`    command: '${this.childProcess.spawnargs.join(' ')}'`, 'info');

      if (debug === true || debug === 'stdout' || debug === 'stderr') {
        this.childProcess.stderr.on('data', (data) => {
          if (String(data).match(/HTTP\/1\.1\"/) !== null) {
            return;
          }
          sgUtil.log(pathToScript, 'error');
          sgUtil.log(data, 'error')
        });
      }

      if (debug === true || debug === 'stdout') {
        this.childProcess.on('data', (data) => {
          sgUtil.log(pathToScript, 'info');
          sgUtil.log(data, 'info');<commit_msg>fix: destructuring issue in http template engine<commit_after>const
  path = require('path'),
  extend = require('extend'),
  spawn = require('child_process').spawn,
  syncRequest = require('sync-request'),
  pretty = require('pretty'),
  sgUtil = require('../util'),
  ConfigManager = require('../ConfigManager');

class httpRenderEngine {

  constructor(options, root, ext) {
    this.options = options;
    this.root = root;
    this.ext = ext;

    this.startServer();
  }

  startServer() {

    const {script: {command, port = 99999, pathToScript, debug} = {}} = this.options;

    if (command && pathToScript) {
      const args = ['-S', `0.0.0.0:${port}`, '-t', pathToScript];

      this.childProcess = spawn(this.options.script.command, args, {stdio: 'pipe', detached: false});

      sgUtil.log(`[✓] ${this.constructor.name}: server started (pid: ${this.childProcess.pid})`, 'info');
      sgUtil.log(`    command: '${this.childProcess.spawnargs.join(' ')}'`, 'info');

      if (debug === true || debug === 'stdout' || debug === 'stderr') {
        this.childProcess.stderr.on('data', (data) => {
          if (String(data).match(/HTTP\/1\.1\"/) !== null) {
            return;
          }
          sgUtil.log(pathToScript, 'error');
          sgUtil.log(data, 'error')
        });
      }

      if (debug === true || debug === 'stdout') {
        this.childProcess.on('data', (data) => {
          sgUtil.log(pathToScript, 'info');
          sgUtil.log(data, 'info');
{'fraction_non_alphanumeric': 0.19835841313269495, 'fraction_numerical': 0.007523939808481532, 'mean_word_length': 2.8741721854304636, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4092541', 'n_tokens_mistral': 956, 'n_tokens_neox': 911, 'n_words': 187}