Debian Codegraph @

src/Lambdabot/Util/Process.hs

raw
1 -- Copyright (c) 2004-6 Don Stewart - http://www.cse.unsw.edu.au/~dons
2 -- GPL version 2 or later (see http://www.gnu.org/copyleft/gpl.html)
3
4 module Lambdabot.Util.Process
5 ( run
6 ) where
7
8 import System.Process
9
10 run :: FilePath -> String -> (String -> String) -> IO String
11 run binary src scrub = do
12 (_,out,err) <- readProcessWithExitCode binary [] src
13 let o = scrub out
14 e = scrub err
15 return $ case () of {_
16 | null o && null e -> "Done."
17 | null o -> e
18 | otherwise -> o
19 }