<commit_before>'use strict';

var fs    = require('fs'),
    async = require('async'),
    ssh   = require('ssh2'),
    noop  = function() {};

var init = function() {
    var done       = this.async(),
        logs       = [],
        target     = this.target,
        config     = this.data,
        hosts      = config.hosts,
        username   = config.username,
        privateKey = config.privateKey,
        password   = config.password;

    var writeBufferedLog = function(host, msg, fn) {
        (logs[host] = logs[host] || []).push(host.cyan + fn(msg || 'OK'));
    };

    var flushBufferedLog = function(host) {
        while(logs[host].length > 0) {
            console.log(logs[host].shift());
        }
        console.log('');
    };

    var executeCommandSet = function(target, callback) {
        var tunnel      = new ssh(),
            host        = target.split(':')[0],
            port        = target.split(':')[1],
            commands    = config.commands.slice(),
            shellPrefix = (username + '@' + host + ':' + port + ' ~$ '),
            response    = [],
            lastError   = null;

        tunnel.on('ready', function() {
            var executeCommand = function(command) {
                var hint    = command.hint,
                    input   = command.input.toString(),
                    success = command.success || noop,
                    error   = command.error || noop,
                    force   = command.force || false;

                if(hint) {
                    writeBufferedLog(shellPrefix, '# ' + hint + (force ? ' (force)' : ''), function(x) { return x.grey; });
                }

                writeBufferedLog(shellPrefix, input, function(x) { return x.yellow; });

                tunnel.exec(input, function(err, stream) {
                    if (err) {
                        throw err;
                    }

                    stream.on('data', function(data, extended) {
                        data = data.toString();
                        if(extended === 'stderr') {
                            lastError = data;
                        } else {
                            lastError = null;
                            response[shellPrefix + input] = data;
                        }
                    });

                    stream.on('close', function(){<commit_msg>fixed a bug in force option that was preventing correct execution of subsequent commands<commit_after>'use strict';

var fs    = require('fs'),
    async = require('async'),
    ssh   = require('ssh2'),
    noop  = function() {};

var init = function() {
    var done       = this.async(),
        logs       = [],
        target     = this.target,
        config     = this.data,
        hosts      = config.hosts,
        username   = config.username,
        privateKey = config.privateKey,
        password   = config.password;

    var writeBufferedLog = function(host, msg, fn) {
        (logs[host] = logs[host] || []).push(host.cyan + fn(msg || 'OK'));
    };

    var flushBufferedLog = function(host) {
        while(logs[host].length > 0) {
            console.log(logs[host].shift());
        }
        console.log('');
    };

    var executeCommandSet = function(target, callback) {
        var tunnel      = new ssh(),
            host        = target.split(':')[0],
            port        = target.split(':')[1],
            commands    = config.commands.slice(),
            shellPrefix = (username + '@' + host + ':' + port + ' ~$ '),
            response    = [],
            lastError   = null;

        tunnel.on('ready', function() {
            var executeCommand = function(command) {
                var hint    = command.hint,
                    input   = command.input.toString(),
                    success = command.success || noop,
                    error   = command.error || noop,
                    force   = command.force || false;

                if(hint) {
                    writeBufferedLog(shellPrefix, '# ' + hint + (force ? ' (force)' : ''), function(x) { return x.grey; });
                }

                writeBufferedLog(shellPrefix, input, function(x) { return x.yellow; });

                tunnel.exec(input, function(err, stream) {
                    if (err) {
                        throw err;
                    }

                    lastError = null;

                    stream.on('data', function(data, extended) {
                        data = data.toString();
                        if(extended === 'stderr') {
                            lastError = data;
                        } else {
                            response[shellPrefix + input] = data;
                        }
                    });

                    stream.on('close', function(){
{'fraction_non_alphanumeric': 0.13146911519198665, 'fraction_numerical': 0.001669449081803005, 'mean_word_length': 1.2878281622911694, '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': '5182000', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1184, 'n_words': 260}