<commit_before>#!/usr/bin/env node

//=========== run_command_sync_to_console: run one command and let output immediately flow to console ============
var run_command_sync_to_console = function (cmd) {
    var execSync = require('child_process').execSync;
    execSync(cmd, {stdio:[0,1,2]}, function(error, stdout, stderr) {
        if (error) {
            console.log('======= RUN ERROR =======');
            throw error;
        }
    });
}


//=========== run_command_quietly: runs without output unless error ============
var run_command_quietly = function (cmd) {
    var execSync = require('child_process').execSync;
    execSync(cmd, function(error, stdout, stderr) {
        if (error) {
            console.log('======= RUN ERROR =======');
            throw error;
        }
    });
}


// =========== run_command: run one command and get output ============
// Run a command asynchronously and get the output when it finishes in a callback.
// Usage:
// run_command( "ls -l", function(text) { console.log (text) });
var run_command = function (cmd, callBack ) {

    // DEBUG
    // run_command_sync_to_console(cmd);

    // Ignorant spawn absolutely whines if you don't split out the arguments.
    var spawnargs = require('spawn-args');
    var args = cmd.split(" ").slice(1);
    var argstring = "";
    for (var i = 0;i < args.length;i++) {
        argstring += args[i] + ' ';
    }
    console.log('argstring: ' + argstring);
    args = spawnargs(argstring);

    cmd = cmd.split(" ",1);

    // DEBUG: 
    // console.log('cmd args: ' + cmd + ' ----- ' + args);

    // DEBUG this works!
    // args = ["status"];
    // cmd = "git";

    // DEBUG
    args = ["commit","-a","-m",'"synctrouble"'];
    cmd = "git";


    // DEBUG: 
    console.log('cmd args: ' + cmd + ' ----- ' + args);

    var spawn = require('child_process').spawn;
    
    var child = spawn(cmd, args);
    // var child = spawn(cmd, args, {stdio: "inherit"});
    if (error) {
        console.log(error.stack);
        console.log('Error code: '+error.code);
        console.log('Signal received: '+error.signal);
    }

    var resp = "";
    child.stdout.on('data', function (buffer) { resp += buffer.toString() });
    child.stderr.on('data', function (buffer) { resp += 'ERROR: ' + buffer.toString() });

    child.stdout.on('end', function() { callBack (resp) });
}

<commit_msg>"synctrouble"<commit_after>#!/usr/bin/env node

//=========== run_command_sync_to_console: run one command and let output immediately flow to console ============
var run_command_sync_to_console = function (cmd) {
    var execSync = require('child_process').execSync;
    execSync(cmd, {stdio:[0,1,2]}, function(error, stdout, stderr) {
        if (error) {
            console.log('======= RUN ERROR =======');
            throw error;
        }
    });
}


//=========== run_command_quietly: runs without output unless error ============
var run_command_quietly = function (cmd) {
    var execSync = require('child_process').execSync;
    execSync(cmd, function(error, stdout, stderr) {
        if (error) {
            console.log('======= RUN ERROR =======');
            throw error;
        }
    });
}


// =========== run_command: run one command and get output ============
// Run a command asynchronously and get the output when it finishes in a callback.
// Usage:
// run_command( "ls -l", function(text) { console.log (text) });
var run_command = function (cmd, callBack ) {

    // DEBUG
    // run_command_sync_to_console(cmd);



    // Ignorant spawn absolutely whines if you don't split out the arguments.
    /*
    var spawnargs = require('spawn-args');
    var args = cmd.split(" ").slice(1);
    var argstring = "";
    for (var i = 0;i < args.length;i++) {
        argstring += args[i] + ' ';
    }
    console.log('argstring: ' + argstring);
    args = spawnargs(argstring);

    cmd = cmd.split(" ",1);
    */

    // DEBUG: 
    // console.log('cmd args: ' + cmd + ' ----- ' + args);

    // DEBUG this works!
    // var args = ["status"];
    cmd = "git";

    // DEBUG
    var args = ["commit","-a","-m",'"synctrouble"'];
























    // DEBUG: 
    // console.log('cmd args: ' + cmd + ' ----- ' + args);

    var spawn = require('child_process').spawn;
    
    var child = spawn(cmd, args);
    // var child = spawn(cmd, args, {stdio: "inherit"});
    
    // THIS SHIT BREAKS EVERYTHING SILENTLY
    /*
    if (error) {
        console.log(error.stack);
        console.log('Error code: '+error.code);
        console.log('Signal received: '+error.signal);
    }
    */

    var resp = "";
    child.stdout.on('data', function (buffer) { resp += buffer.toString() });
    child.stderr.on('data', function (buffer) { resp += 'ERROR: ' + buffer.toString() });

    child.stdout.on('end', function() { callBack (resp) });
}


{'fraction_non_alphanumeric': 0.19950433705080545, 'fraction_numerical': 0.0024783147459727386, 'mean_word_length': 2.6007434944237917, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2300298', 'n_tokens_mistral': 1560, 'n_tokens_neox': 1474, 'n_words': 377}