Don't clean up tmp dirs when --keep=always
This commit is contained in:
parent
d1075987de
commit
d5a680e3c6
@ -465,15 +465,22 @@ withGHCupTmpDir :: ( MonadReader env m
|
|||||||
, MonadMask m
|
, MonadMask m
|
||||||
, MonadIO m)
|
, MonadIO m)
|
||||||
=> m GHCupPath
|
=> m GHCupPath
|
||||||
withGHCupTmpDir = snd <$> withRunInIO (\run ->
|
withGHCupTmpDir = do
|
||||||
run
|
Settings{keepDirs} <- getSettings
|
||||||
$ allocate
|
snd <$> withRunInIO (\run ->
|
||||||
(run mkGhcupTmpDir)
|
run
|
||||||
(\fp ->
|
$ allocate
|
||||||
handleIO (\e -> run
|
(run mkGhcupTmpDir)
|
||||||
$ logDebug ("Resource cleanup failed for " <> T.pack (fromGHCupPath fp) <> ", error was: " <> T.pack (displayException e)))
|
(\fp -> if -- we don't know whether there was a failure, so can only
|
||||||
. removePathForcibly
|
-- decide for 'Always'
|
||||||
$ fp))
|
| keepDirs == Always -> pure ()
|
||||||
|
| otherwise -> handleIO (\e -> run
|
||||||
|
$ logDebug ("Resource cleanup failed for "
|
||||||
|
<> T.pack (fromGHCupPath fp)
|
||||||
|
<> ", error was: "
|
||||||
|
<> T.pack (displayException e)))
|
||||||
|
. removePathForcibly
|
||||||
|
$ fp))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user