<commit_before>use std::process::Output;
use std::fs::{File, OpenOptions};
use std::io::{Read, Write, Seek, SeekFrom};
use std::path::Path;
use rr_result::{RrResult, err_message};

pub fn check_output(out: &Output) -> RrResult<()> {
    if out.status.success() {
        return Ok(());
    }

    err_message(String::from_utf8_lossy(&out.stderr).into_owned())<commit_msg>If 'stderr' of an unsuccessful 'Output' is empty take the 'stdout'<commit_after>use std::process::Output;
use std::fs::{File, OpenOptions};
use std::io::{Read, Write, Seek, SeekFrom};
use std::path::Path;
use rr_result::{RrResult, err_message};

pub fn check_output(out: &Output) -> RrResult<()> {
    if out.status.success() {
        return Ok(());
    }

    let mut msg = String::from_utf8_lossy(&out.stderr).into_owned();
    if msg.is_empty() {
        msg = String::from_utf8_lossy(&out.stdout).into_owned();
    }

    err_message(msg)
{'fraction_non_alphanumeric': 0.17943107221006566, 'fraction_numerical': 0.0032822757111597373, 'mean_word_length': 4.828025477707007, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6833966', 'n_tokens_mistral': 324, 'n_tokens_neox': 325, 'n_words': 67}