<commit_before>const { app } = require('electron');
const { EventEmitter } = require('events');
const { exec } = require('child_process');
const defaultShell = require('default-shell');
const { productName, version } = require('./package');

let spawn;
try {
  spawn = require('child_pty').spawn;
} catch (err) {
  console.error(
    'A native module failed to load. Typically this means ' +
    'you installed the modules incorrectly.\n Use `scripts/install.sh` ' +
    'to trigger the installation.\n ' +
    'More information: https://github.com/zeit/hyperterm/issues/72'
  );
}

const TITLE_POLL_INTERVAL = 500;

module.exports = class Session extends EventEmitter {

  constructor ({ rows, cols: columns, cwd, shell }) {
    super();
    this.pty = spawn(shell || defaultShell, ['--login'], {
      columns,
      rows,
      cwd,
      env: Object.assign({}, process.env, {
        LANG: app.getLocale(),
        TERM: 'xterm-256color',
        TERM_PROGRAM: productName,
        TERM_PROGRAM_VERSION: version
      })
    });

    this.pty.stdout.on('data', (data) => {
      this.emit('data', data.toString('utf8'));
    });

    this.pty.on('exit', () => {
      if (!this.ended) {
        this.ended = true;
        this.emit('exit');
      }
    });

    this.shell = defaultShell;
    this.getTitle();
  }

  focus () {
    this.subscribed = true;
    this.getTitle();
  }

  blur () {
    this.subscribed = false;<commit_msg>fix shell property value (#377)<commit_after>const { app } = require('electron');
const { EventEmitter } = require('events');
const { exec } = require('child_process');
const defaultShell = require('default-shell');
const { productName, version } = require('./package');

let spawn;
try {
  spawn = require('child_pty').spawn;
} catch (err) {
  console.error(
    'A native module failed to load. Typically this means ' +
    'you installed the modules incorrectly.\n Use `scripts/install.sh` ' +
    'to trigger the installation.\n ' +
    'More information: https://github.com/zeit/hyperterm/issues/72'
  );
}

const TITLE_POLL_INTERVAL = 500;

module.exports = class Session extends EventEmitter {

  constructor ({ rows, cols: columns, cwd, shell }) {
    super();
    this.pty = spawn(shell || defaultShell, ['--login'], {
      columns,
      rows,
      cwd,
      env: Object.assign({}, process.env, {
        LANG: app.getLocale(),
        TERM: 'xterm-256color',
        TERM_PROGRAM: productName,
        TERM_PROGRAM_VERSION: version
      })
    });

    this.pty.stdout.on('data', (data) => {
      this.emit('data', data.toString('utf8'));
    });

    this.pty.on('exit', () => {
      if (!this.ended) {
        this.ended = true;
        this.emit('exit');
      }
    });

    this.shell = shell || defaultShell;
    this.getTitle();
  }

  focus () {
    this.subscribed = true;
    this.getTitle();
  }

  blur () {
    this.subscribed = false;
{'fraction_non_alphanumeric': 0.16293489493627283, 'fraction_numerical': 0.007233895969686531, 'mean_word_length': 2.7665369649805447, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '6216772', 'n_tokens_mistral': 950, 'n_tokens_neox': 914, 'n_words': 204}