<commit_before># Start the crash reporter before anything else.
require('crash-reporter').start(productName: 'Atom', companyName: 'GitHub')
remote = require 'remote'

exitWithStatusCode = (status) ->
  remote.require('app').emit('will-quit')
  remote.process.exit(status)

try
  path = require 'path'
  ipc = require 'ipc'
  {getWindowLoadSettings} = require './window-load-settings-helpers'
  AtomEnvironment = require '../src/atom-environment'
  ApplicationDelegate = require '../src/application-delegate'

  {testRunnerPath, legacyTestRunnerPath, headless, logFile, testPaths} = getWindowLoadSettings()

  # Show window synchronously so a focusout doesn't fire on input elements
  # that are focused in the very first spec run.
  remote.getCurrentWindow().show() unless headless

  handleKeydown = (event) ->
    # Reload: cmd-r / ctrl-r
    if (event.metaKey or event.ctrlKey) and event.keyCode is 82
      ipc.send('call-window-method', 'restart')

    # Toggle Dev Tools: cmd-alt-i / ctrl-alt-i
    if (event.metaKey or event.ctrlKey) and event.altKey and event.keyCode is 73
      ipc.send('call-window-method', 'toggleDevTools')

    # Reload: cmd-w / ctrl-w
    if (event.metaKey or event.ctrlKey) and event.keyCode is 87
      ipc.send('call-window-method', 'close')

  window.addEventListener('keydown', handleKeydown, true)

  # Add 'exports' to module search path.
  exportsPath = path.join(getWindowLoadSettings().resourcePath, 'exports')
  require('module').globalPaths.push(exportsPath)<commit_msg>Override console.log/error/warn in headless mode to log to stdout/stderr<commit_after># Start the crash reporter before anything else.
require('crash-reporter').start(productName: 'Atom', companyName: 'GitHub')
remote = require 'remote'

exitWithStatusCode = (status) ->
  remote.require('app').emit('will-quit')
  remote.process.exit(status)

try
  path = require 'path'
  ipc = require 'ipc'
  {getWindowLoadSettings} = require './window-load-settings-helpers'
  AtomEnvironment = require '../src/atom-environment'
  ApplicationDelegate = require '../src/application-delegate'

  {testRunnerPath, legacyTestRunnerPath, headless, logFile, testPaths} = getWindowLoadSettings()

  if headless
    # Override logging in headless mode so it goes to the console, regardless
    # of the --enable-logging flag to Electron.
    console.log = (args...) ->
      ipc.send 'write-to-stdout', args.join(' ') + '\n'
    console.warn = (args...) ->
      ipc.send 'write-to-stderr', args.join(' ') + '\n'
    console.error = (args...) ->
      ipc.send 'write-to-stderr', args.join(' ') + '\n'
  else
    # Show window synchronously so a focusout doesn't fire on input elements
    # that are focused in the very first spec run.
    remote.getCurrentWindow().show()

  handleKeydown = (event) ->
    # Reload: cmd-r / ctrl-r
    if (event.metaKey or event.ctrlKey) and event.keyCode is 82
      ipc.send('call-window-method', 'restart')

    # Toggle Dev Tools: cmd-alt-i / ctrl-alt-i
    if (event.metaKey or event.ctrlKey) and event.altKey and event.keyCode is 73
      ipc.send('call-window-method', 'toggleDevTools')

    # Reload: cmd-w / ctrl-w
    if (event.metaKey or event.ctrlKey) and event.keyCode is 87
      ipc.send('call-window-method', 'close')

  window.addEventListener('keydown', handleKeydown, true)

  # Add 'exports' to module search path.
  exportsPath = path.join(getWindowLoadSettings().resourcePath, 'exports')
  require('module').globalPaths.push(exportsPath)
{'fraction_non_alphanumeric': 0.13331422018348624, 'fraction_numerical': 0.0034403669724770644, 'mean_word_length': 3.819060773480663, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '1988184', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1063, 'n_words': 288}