<commit_before>//
// Copyright (c) 2016, <NAME> <<EMAIL>>
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//

use logger;
use env;
use std::process::Command;

pub struct Executor {
}

impl Executor {
    pub fn new() -> Executor {
        Executor{}
    }

    pub fn start(&self, l: &logger::Logger, e: &env::Env) {
        let es = e.getScript().to_string() + " " + e.getDir();
        let res = Command::new(e.getScript())
            .arg(e.getDir()).status();
        match res {
            Ok(o) => {
                if o.success() {
                    let mut ss = "Executing ".to_string();
                    ss += &es;
                    ss += " OK!";
                    l.info(&ss);
                } else {
                    let os = o.code();
                    let mut ec = es;
                    match os {
                        None => {
                            ec += "Terminated by a signal!";
                        },
                        Some(t) => {
                            ec += " Exit code: ";
                            ec += &(format!("{}", t));
                        }
                    }
                    l.info(&ec);
                }
            },
            Err(e) => {
                let mut ss = "Error of executing ".to_string();
                ss += &es;
                ss += " ";
                ss += &(format!("{}", e));
                self.error__(ss, l);<commit_msg>fix syslog out for Executor<commit_after>//
// Copyright (c) 2016, <NAME> <<EMAIL>>
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//

use logger;
use env;
use std::process::Command;

pub struct Executor {
}

impl Executor {
    pub fn new() -> Executor {
        Executor{}
    }

    pub fn start(&self, l: &logger::Logger, e: &env::Env) {
        let es = e.getScript().to_string() + " " + e.getDir();
        l.info("Trying execute command...");
        let res = Command::new(e.getScript())
            .arg(e.getDir()).status();
        match res {
            Ok(o) => {
                if o.success() {
                    let mut ss = "... ".to_string();
                    ss += &es;
                    ss += " OK!";
                    l.info(&ss);
                } else {
                    let os = o.code();
                    let mut ec = es;
                    match os {
                        None => {
                            ec += "Terminated by a signal!";
                        },
                        Some(t) => {
                            ec += " Exit code: ";
                            ec += &(format!("{}", t));
                        }
                    }
                    l.info(&ec);
                }
            },
            Err(e) => {
                let mut ss = "Error of executing ".to_string();
                ss += &es;
                ss += " ";
                ss += &(format!("{}", e));
                self.error__(ss, l);
{'fraction_non_alphanumeric': 0.1471221914435211, 'fraction_numerical': 0.0049245921822099106, 'mean_word_length': 0.9950890116635973, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4844300', 'n_tokens_mistral': 924, 'n_tokens_neox': 864, 'n_words': 257}