<commit_before>
module Development.Shake.Derived where

import Control.Monad
import Control.Monad.IO.Class
import System.Process
import System.Directory
import System.Exit
import qualified Data.ByteString.Char8 as BS

import Development.Shake.Core
import Development.Shake.File
import Development.Shake.FilePath


-- | Execute a system command. This function will raise an error if the exit code is non-zero.
--   Before running 'system'' make sure you 'need' any required files.
system' :: FilePath -> [String] -> Action ()
system' path args = do
    let path2 = toNative path
    let cmd = unwords $ path2 : args
    putLoud cmd
    res <- traced ("system " ++ cmd) $ rawSystem path2 args
    when (res /= ExitSuccess) $
        error $ "System command failed:\n" ++ cmd

-- | Execute a system command, returning @(stdout,stderr)@.
--   This function will raise an error if the exit code is non-zero.
--   Before running 'systemOutput'' make sure you 'need' any required files.
systemOutput :: FilePath -> [String] -> Action (String, String)
systemOutput path args = do
    let path2 = toNative path
    let cmd = unwords $ path2 : args
    putLoud cmd
    (res,stdout,stderr) <- traced ("system' " ++ cmd) $ readProcessWithExitCode path2 args ""
    when (res /= ExitSuccess) $
        error $ "System command failed:\n" ++ cmd
    return (stdout, stderr)

<commit_msg>Fix a typo in the docs for systemOutput<commit_after>
module Development.Shake.Derived where

import Control.Monad
import Control.Monad.IO.Class
import System.Process
import System.Directory
import System.Exit
import qualified Data.ByteString.Char8 as BS

import Development.Shake.Core
import Development.Shake.File
import Development.Shake.FilePath


-- | Execute a system command. This function will raise an error if the exit code is non-zero.
--   Before running 'system'' make sure you 'need' any required files.
system' :: FilePath -> [String] -> Action ()
system' path args = do
    let path2 = toNative path
    let cmd = unwords $ path2 : args
    putLoud cmd
    res <- traced ("system " ++ cmd) $ rawSystem path2 args
    when (res /= ExitSuccess) $
        error $ "System command failed:\n" ++ cmd

-- | Execute a system command, returning @(stdout,stderr)@.
--   This function will raise an error if the exit code is non-zero.
--   Before running 'systemOutput' make sure you 'need' any required files.
systemOutput :: FilePath -> [String] -> Action (String, String)
systemOutput path args = do
    let path2 = toNative path
    let cmd = unwords $ path2 : args
    putLoud cmd
    (res,stdout,stderr) <- traced ("system' " ++ cmd) $ readProcessWithExitCode path2 args ""
    when (res /= ExitSuccess) $
        error $ "System command failed:\n" ++ cmd
    return (stdout, stderr)


{'fraction_non_alphanumeric': 0.10148067894546768, 'fraction_numerical': 0.005055976886962802, 'mean_word_length': 3.410828025477707, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7362927', 'n_tokens_mistral': 801, 'n_tokens_neox': 782, 'n_words': 311}