Add `withDirectory_` to Utils

This commit is contained in:
Daniel Gröber 2014-05-01 02:10:42 +02:00
parent aec46dbd51
commit 19b56738c6
1 changed files with 5 additions and 0 deletions

View File

@ -18,3 +18,8 @@ readProcess' cmd opts = do
fail $ cmd ++ " " ++ unwords opts ++ " (exit " ++ show val ++ ")"
ExitSuccess ->
return output
withDirectory_ :: FilePath -> IO a -> IO a
withDirectory_ dir action =
bracket getCurrentDirectory setCurrentDirectory
(\_ -> setCurrentDirectory dir >> action)