<commit_before>const {
    spawn
} = require("child_process");

const gitCommand = "git";
const gitDiff = "diff";
const statOption = "--numstat";

function promisify(child_process) {
    return new Promise((resolve, reject) => {
        const result = "";

        child_process.stdout.on('data', data => {
            result.push(data.toString());
        });

        child_process.on('error', (err) => {
            reject(err);
        })

        child_process.on('close', () => {
            resolve(result);
        });
    });
}

module.exports = {
    getDiff: function (commit1, commit2, options) {

        const gitProcess = spawn(gitCommand, [gitDiff, statOption, commit1, commit2], {<commit_msg>Return output from child process git diff<commit_after>const {
    spawn
} = require("child_process");

const Promise = require("bluebird").Promise;

const gitCommand = "git";
const gitDiff = "diff";
const statOption = "--numstat";

function promisify(child) {
    return new Promise((resolve, reject) => {
        let result = "";

        child.stdout.on('data', data => {
            console.log(data.toString());
            result += data;
        });

        child.stderr.on('data', data => {
            console.error(data.toString());
        });

        child.on('error', (err) => {
            reject(err);
        });

        child.on('exit', () => {
            resolve(result);
        });
    });
}

module.exports = {
    getDiff: function (commit1, commit2, options) {

        const gitProcess = spawn(gitCommand, [gitDiff, statOption, commit1, commit2], {
            // stdio: "inherit",
{'fraction_non_alphanumeric': 0.16069221260815822, 'fraction_numerical': 0.004944375772558714, 'mean_word_length': 2.3450413223140494, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '2945529', 'n_tokens_mistral': 471, 'n_tokens_neox': 463, 'n_words': 98}