<commit_before>import {exec} from 'child_process';
import {isAbsolute} from 'path';

function launch(path, options = {}) {
  if(!isAbsolute(path)) {
    return new Error('Application path "%s" is not absolute.', path);
  }
  if(!options instanceof Object) {
    return new Error('Option passed to launch must be an instance of Object, got ', typeof options);
  }

  if(!options.detached instanceof Boolean) {
    return new Error('Option key \'detached\' must an instance of Boolean, got ', typeof options.detached);
  }

  return exec(path, {detached: options.detached || true}, (err, stdout, stderr) => {
    if(err) {
      console.log(stderr);
    }<commit_msg>Fix throw error instead of returning<commit_after>import {exec} from 'child_process';
import {isAbsolute} from 'path';

function launch(path, options = {}) {
  if(!isAbsolute(path)) {
    throw new Error('Application path "%s" is not absolute.', path);
  }
  if(!options instanceof Object) {
    throw new Error('Option passed to launch must be an instance of Object, got ', typeof options);
  }

  if(!options.detached instanceof Boolean) {
    throw new Error('Option key \'detached\' must an instance of Boolean, got ', typeof options.detached);
  }

  return exec(path, {detached: options.detached || true}, (err, stdout, stderr) => {
    if(err) {
      console.log(stderr);
    }
{'fraction_non_alphanumeric': 0.1348148148148148, 'fraction_numerical': 0.0, 'mean_word_length': 4.078947368421052, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7198010', 'n_tokens_mistral': 394, 'n_tokens_neox': 388, 'n_words': 135}