<commit_before>package org.openforis.sepal.util

class Terminal {

    static String execute(File workingDir, String... commands) {
        def builder = new ProcessBuilder(commands)
                .directory(workingDir)
        try {
            Process process = builder.start()
            def result = process.waitFor()
            if (result != 0) {
                throw new IllegalStateException("Failed to execute '${commands.join(' ')}' in ${workingDir}. exitCode: $result, '$process.text'")
            }
            return process.text
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt()
            throw new IllegalStateException(e)
        } catch (IOException e) {
            throw new IOException("Failed to execute $commands", e)
        }
    }
}<commit_msg>Logged stderr on no 0 exit code.<commit_after>package org.openforis.sepal.util

class Terminal {

    static String execute(File workingDir, String... commands) {
        def builder = new ProcessBuilder(commands)
                .directory(workingDir)
        try {
            Process process = builder.start()
            def result = process.waitFor()
            if (result != 0) {
                throw new IllegalStateException("Failed to execute '${commands.join(' ')}' in ${workingDir}. " +
                        "exitCode: $result, " +
                        "stderr: '$process.err.text'",
                )
            }
            return process.text
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt()
            throw new IllegalStateException(e)
        } catch (IOException e) {
            throw new RuntimeException("Failed to execute $commands", e)
        }
    }
}
{'fraction_non_alphanumeric': 0.10435779816513761, 'fraction_numerical': 0.0017201834862385322, 'mean_word_length': 1.8747940691927512, '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': '5155774', 'n_tokens_mistral': 434, 'n_tokens_neox': 421, 'n_words': 117}