diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2017-06-12 04:23:44 +0200 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2017-06-12 04:23:44 +0200 |
commit | a8551e48ccb189202d8c7aa587c50044d7c41471 (patch) | |
tree | 910d160faac37655097bfaeaba04add5ce6c610d | |
parent | 2bc14d2f812c300ad32fe41c53c30405bab61502 (diff) |
Fix unpackCabalHEAD again due to old 'process'
-rw-r--r-- | CabalHelper/Compile.hs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/CabalHelper/Compile.hs b/CabalHelper/Compile.hs index 5071e15..2d0007d 100644 --- a/CabalHelper/Compile.hs +++ b/CabalHelper/Compile.hs @@ -375,9 +375,16 @@ unpackCabalHEAD tmpdir = do let dir = tmpdir </> "cabal-head.git" url = "https://github.com/haskell/cabal.git" ExitSuccess <- rawSystem "git" [ "clone", "--depth=1", url, dir] - let git_rev_parse = (proc "git" ["rev-parse", "HEAD"]) { cwd = Just dir } - commit <- trim <$> readCreateProcess git_rev_parse "" + commit <- + withDirectory_ dir $ trim <$> readProcess "git" ["rev-parse", "HEAD"] "" return (dir </> "Cabal", commit) + where + withDirectory_ :: FilePath -> IO a -> IO a + withDirectory_ dir action = + bracket + (liftIO getCurrentDirectory) + (liftIO . setCurrentDirectory) + (\_ -> liftIO (setCurrentDirectory dir) >> action) errorInstallCabal :: Version -> FilePath -> a errorInstallCabal cabalVer _distdir = panic $ printf "\ |