Skip to content

Commit

Permalink
sensible exit value for shell
Browse files Browse the repository at this point in the history
  • Loading branch information
mwotton committed Apr 26, 2015
1 parent 246a8af commit 6519a11
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Marvin.hs
Expand Up @@ -10,7 +10,8 @@ import qualified Data.Text.IO as TIO
import System.Cmd
import System.Directory
import System.Environment (getArgs)
import System.Exit (ExitCode (ExitSuccess))
import System.Exit (ExitCode (ExitSuccess), exitFailure,
exitSuccess)

main :: IO ()
main = do
Expand All @@ -29,12 +30,9 @@ main = do
let justPkgs' = map (T.replace "," "" . T.replace " ==" "-") useful
createDirectoryIfMissing False "./marvin-tmp"
let (ignored, justPkgs) = partition ignorable justPkgs'
-- print ("ignoring", ignored)

results <- (`mapM` justPkgs) $ \pkg -> do
print ("running with", pkg)
-- let dirname = ("./marvin-tmp/" ++ T.unpack pkg)
-- createDirectoryIfMissing False dirname
origSandbox <- (<> "/.cabal-sandbox") <$> getCurrentDirectory

withCurrDir "marvin-tmp" $ do
Expand All @@ -54,9 +52,11 @@ main = do
putStrLn ""
putStrLn "Failures"
TIO.putStr $ T.unlines $ map fst failures
if failures == []
then exitSuccess
else exitFailure



withCurrDir :: FilePath -> IO b -> IO b
withCurrDir x f = do
orig <- getCurrentDirectory
bracket_ (setCurrentDirectory x) (setCurrentDirectory orig) f

0 comments on commit 6519a11

Please sign in to comment.