<commit_before>const CDP = require('chrome-remote-interface');
const { spawn } = require('child_process');
const util = require('../util.js');
const fs = require('fs');
const os = require('os');

const chrome = exports = module.exports = {};

chrome.name = 'Chrome';



chrome.spawn = function(options) {
	return new Promise((resolve, reject) => {
		this.options = options;
		let location = this.getChromeLocation();

		if (!fs.existsSync(location)) {
			util.log('unable to find Chrome install. Please specify with chromeLocation');
			return reject();
		}

		this.chromeChild = spawn(location, ['--headless', '--disable-gpu', '--remote-debugging-port=9222']);

		resolve();
	});
};



chrome.onClose = function(callback) {
	this.chromeChild.on('close', callback);
};



chrome.kill = function() {
	this.chromeChild.kill('SIGINT');
};

<commit_msg>allow passing of chrome flags through to chrome<commit_after>const CDP = require('chrome-remote-interface');
const { spawn } = require('child_process');
const util = require('../util.js');
const fs = require('fs');
const os = require('os');

const chrome = exports = module.exports = {};

chrome.name = 'Chrome';



chrome.spawn = function(options) {
	return new Promise((resolve, reject) => {
		this.options = options;
		let location = this.getChromeLocation();

		if (!fs.existsSync(location)) {
			util.log('unable to find Chrome install. Please specify with chromeLocation');
			return reject();
		}

		this.chromeChild = spawn(location, this.options.chromeFlags || ['--headless', '--disable-gpu', '--remote-debugging-port=9222']);

		resolve();
	});
};



chrome.onClose = function(callback) {
	this.chromeChild.on('close', callback);
};



chrome.kill = function() {
	this.chromeChild.kill('SIGINT');
};


{'fraction_non_alphanumeric': 0.17727272727272728, 'fraction_numerical': 0.004545454545454545, 'mean_word_length': 4.503125, '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': '5734413', 'n_tokens_mistral': 581, 'n_tokens_neox': 531, 'n_words': 124}