[commit: packages/directory] master: Use createDirectoryIfMissing in test/Util.hs to avoid silly errors (73d1ef0)

git at git.haskell.org git at git.haskell.org
Fri Dec 18 09:53:15 UTC 2015


Repository : ssh://git@git.haskell.org/directory

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/73d1ef0602e7389c7c28773df0e63fff90cf1762/directory

>---------------------------------------------------------------

commit 73d1ef0602e7389c7c28773df0e63fff90cf1762
Author: Phil Ruffwind <rf at rufflewind.com>
Date:   Sun Oct 11 03:50:31 2015 -0400

    Use createDirectoryIfMissing in test/Util.hs to avoid silly errors
    
    It seems that 'stack' does not use nor create the 'dist' directory, so
    we have to do this ourselves.


>---------------------------------------------------------------

73d1ef0602e7389c7c28773df0e63fff90cf1762
 tests/Util.hs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/Util.hs b/tests/Util.hs
index 2ef5ec0..ca4a448 100644
--- a/tests/Util.hs
+++ b/tests/Util.hs
@@ -16,7 +16,7 @@ import Control.Concurrent.MVar (newEmptyMVar, putMVar, readMVar)
 import Control.Exception (SomeException, bracket_, catch,
                           mask, onException, try)
 import Control.Monad (Monad(..), unless, when)
-import System.Directory (createDirectory, makeAbsolute,
+import System.Directory (createDirectoryIfMissing, makeAbsolute,
                          removeDirectoryRecursive, withCurrentDirectory)
 import System.Environment (getArgs)
 import System.Exit (exitFailure)
@@ -134,7 +134,7 @@ expectIOErrorType t file line context which action = do
 withNewDirectory :: Bool -> FilePath -> IO a -> IO a
 withNewDirectory keep dir action = do
   dir' <- makeAbsolute dir
-  bracket_ (createDirectory dir') (cleanup dir') action
+  bracket_ (createDirectoryIfMissing True dir') (cleanup dir') action
   where cleanup dir' | keep      = return ()
                      | otherwise = removeDirectoryRecursive dir'
 



More information about the ghc-commits mailing list