<commit_before>//
//  ExecuteTaskNowShellOut.swift
//  RsyncOSX
//
//  Created by <NAME> on 12/07/2020.
//  Copyright © 2020 <NAME>. All rights reserved.
//
//  swiftlint:disable line_length

import Foundation
import ShellOut

final class ExecuteTaskNowShellOut: ExecuteTaskNow {
    var error: Bool = false

    func executepretask() throws {
        if let index = self.index {
            if let pretask = self.configurations?.getConfigurations()[index].pretask {
                let task = try shellOut(to: pretask)
                let outputprocess = OutputProcess()
                outputprocess.addlinefromoutput(str: "ShellOut: execute pretask")
                outputprocess.addlinefromoutput(str: task.self)
                _ = Logging(outputprocess, true)
                if task.self.contains("error") {
                    self.error = true
                }
            }
        }
    }

    func executeposttask() throws {
        if let index = self.index {
            if let posttask = self.configurations?.getConfigurations()[index].posttask {
                let task = try shellOut(to: posttask)
                let outputprocess = OutputProcess()
                outputprocess.addlinefromoutput(str: "ShellOut: execute posttask")
                outputprocess.addlinefromoutput(str: task.self)
                _ = Logging(outputprocess, true)
            }
        }
    }

    override func executetasknow() {
        if let index = self.index {
            // Execute pretask<commit_msg>Update ExecuteTaskNowShellOut.swift<commit_after>//
//  ExecuteTaskNowShellOut.swift
//  RsyncOSX
//
//  Created by <NAME> on 12/07/2020.
//  Copyright © 2020 <NAME>. All rights reserved.
//
//  swiftlint:disable line_length

import Foundation
import ShellOut

final class ExecuteTaskNowShellOut: ExecuteTaskNow {
    var error: Bool = false

    func executepretask() throws {
        if let index = self.index {
            if let pretask = self.configurations?.getConfigurations()[index].pretask {
                let task = try shellOut(to: pretask)
                let outputprocess = OutputProcess()
                outputprocess.addlinefromoutput(str: "ShellOut: execute pretask")
                outputprocess.addlinefromoutput(str: task.self)
                _ = Logging(outputprocess, true)
                if task.self.contains("error") {
                    let outputprocess = OutputProcess()
                    outputprocess.addlinefromoutput(str: "ShellOut: pretask containes error, aborting")
                    _ = Logging(outputprocess, true)
                    self.error = true
                }
            }
        }
    }

    func executeposttask() throws {
        if let index = self.index {
            if let posttask = self.configurations?.getConfigurations()[index].posttask {
                let task = try shellOut(to: posttask)
                let outputprocess = OutputProcess()
                outputprocess.addlinefromoutput(str: "ShellOut: execute posttask")
                outputprocess.addlinefromoutput(str: task.self)
                _ = Logging(outputprocess, true)
            }
        }
    }

    override func executetasknow() {
        if let index = self.index {
            // Execute pretask
{'fraction_non_alphanumeric': 0.08898435102792268, 'fraction_numerical': 0.00736422215403498, 'mean_word_length': 1.900355871886121, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1440921', 'n_tokens_mistral': 899, 'n_tokens_neox': 836, 'n_words': 203}