<commit_before>'use strict';
var exec = require('child_process').exec,
	MotorBoat = require('motorboat'),
	CommandError = require('./command/command-error');

function SpeedBoat(options) {
	MotorBoat.call(this, options);
}

SpeedBoat.prototype = Object.create(MotorBoat.prototype);
SpeedBoat.prototype.constructor = SpeedBoat;

SpeedBoat.prototype.plot = function (boxId, cmd, cb) {
	var self = this;
	var plot = function (cb) {
		console.log('running command:', cmd);
		self.runInstanceCommand(boxId, cmd, function (err, result) {
			if (err) {
				var error = new CommandError('unable to run command: ' + err.toString(), cmd);
				error.innerError = err;
				return cb(err);
			}
			cb(null, result);
		});
	};
	/*
	 * If we have a callback already, invoke the plot and
	 * let the callback handle the result
	 */
	if (cb) {
		return plot(cb);
	}
	/*
	 * If we don't have a callback, the plot will be used
	 * elsewhere (e.g., in an async.* method)
	 */
	return plot;
};

SpeedBoat.prototype.purgeKnownHost = function (ipAddress, knownHostsPath, cb) {

	var cmd = ('ssh-keygen -f "%s" -R %s')
		.replace('%s', knownHostsPath)
		.replace('%s', ipAddress);

	console.info('purging known host', cmd);

	exec(cmd, function (err, stdout, stderr) {
		console.info('???', arguments);
		if (err) {
			err.detail = stderr.toString();
			return cb(err);
		}
		console.info((stdout || '').toString());
		cb();
	});
};

module.exports = SpeedBoat;<commit_msg>error handling<commit_after>'use strict';
var exec = require('child_process').exec,
	MotorBoat = require('motorboat'),
	CommandError = require('./command/command-error');

function SpeedBoat(options) {
	MotorBoat.call(this, options);
}

SpeedBoat.prototype = Object.create(MotorBoat.prototype);
SpeedBoat.prototype.constructor = SpeedBoat;

SpeedBoat.prototype.plot = function (boxId, cmd, cb) {
	var self = this;
	var plot = function (cb) {
		console.log('running command:', cmd);
		self.runInstanceCommand(boxId, cmd, function (err, result) {
			if (err) {
				var error = new CommandError('unable to run command: ' + err.toString(), cmd);
				error.innerError = err;
				return cb(err);
			}
			cb(null, result);
		});
	};
	/*
	 * If we have a callback already, invoke the plot and
	 * let the callback handle the result
	 */
	if (cb) {
		return plot(cb);
	}
	/*
	 * If we don't have a callback, the plot will be used
	 * elsewhere (e.g., in an async.* method)
	 */
	return plot;
};

SpeedBoat.prototype.purgeKnownHost = function (ipAddress, knownHostsPath, cb) {

	var cmd = ('ssh-keygen -f "%s" -R %s')
		.replace('%s', knownHostsPath)
		.replace('%s', ipAddress);

	console.info('purging known host', cmd);

	exec(cmd, function (err, stdout, stderr) {
		if (err) {
			console.error(stderr.toString());
			return cb(err);
		}
		console.info((stdout || '').toString());
		cb();
	});
};

module.exports = SpeedBoat;
{'fraction_non_alphanumeric': 0.16288803627485177, 'fraction_numerical': 0.0, 'mean_word_length': 3.9025641025641025, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5956947', 'n_tokens_mistral': 1065, 'n_tokens_neox': 969, 'n_words': 259}