module Main where import System.Directory import System.Exit import System.FilePath import System.Posix.Temp import System.Process import Gargoyle import Gargoyle.PostgreSQL main :: IO () main = do (exitCode, paths, _) <- readProcessWithExitCode "find" [ "." , "-executable" , "-type", "f" , "-iname", "gargoyle-postgres-monitor" ] "" case exitCode of ExitSuccess -> case lines paths of (path:_) -> do let testPostgres = defaultPostgres { _gargoyle_exec = path } --TODO make this exception safe testPath <- mkdtemp "psql-test" psqlLocal testPostgres "psql" (testPath "db") (Just "") removeDirectoryRecursive testPath exitSuccess _ -> error "Could not find gargoyle-postgres-monitor"