Skip to content

Commit

Permalink
Remove uncompressed .tar file #376
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Jun 23, 2015
1 parent c2e5af3 commit 90791a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased

* Remove GHC uncompressed tar file after installation [#376](https://github.com/commercialhaskell/stack/issues/376)

## 0.1.0.0

* Fall back to cabal dependency solver when a snapshot can't be found
Expand Down
10 changes: 9 additions & 1 deletion src/Stack/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Stack.Setup
) where

import Control.Applicative
import Control.Exception.Enclosed (catchIO)
import Control.Monad (liftM, when, join, void)
import Control.Monad.Catch
import Control.Monad.IO.Class (MonadIO, liftIO)
Expand Down Expand Up @@ -54,7 +55,7 @@ import Stack.GhcPkg (getCabalPkgVer, getGlobalDB)
import Stack.Solver (getGhcVersion)
import Stack.Types
import Stack.Types.StackT
import System.Directory (doesDirectoryExist, createDirectoryIfMissing)
import System.Directory (doesDirectoryExist, createDirectoryIfMissing, removeFile)
import System.Exit (ExitCode (ExitSuccess))
import System.FilePath (searchPathSeparator)
import qualified System.FilePath as FP
Expand Down Expand Up @@ -580,6 +581,13 @@ installGHCWindows si archiveFile archiveType destDir _ = do

run7z (parent archiveFile) archiveFile
run7z (parent archiveFile) tarFile
liftIO (removeFile $ toFilePath tarFile) `catchIO` \e ->
$logWarn (T.concat
[ "Exception when removing "
, T.pack $ toFilePath tarFile
, ": "
, T.pack $ show e
])

$logInfo $ "GHC installed to " <> T.pack (toFilePath destDir)

Expand Down

0 comments on commit 90791a6

Please sign in to comment.