Compare commits

..

1 Commits

Author SHA1 Message Date
2783b8f693 Fix 'ghcup install hls -u' on windows
Fixes #716
2023-01-02 20:38:58 +08:00
2 changed files with 10 additions and 17 deletions

View File

@@ -452,7 +452,7 @@ install installCommand settings getAppState' runLogger = case installCommand of
(_tvVersion -> v, vi) <- liftE $ fromVersion instVer HLS (_tvVersion -> v, vi) <- liftE $ fromVersion instVer HLS
-- TODO: support legacy -- TODO: support legacy
liftE $ runBothE' (installHLSBindist liftE $ runBothE' (installHLSBindist
(DownloadInfo uri (Just $ RegexDir "haskell-language-server-*") "") (DownloadInfo uri (if isWindows then Nothing else Just (RegexDir "haskell-language-server-*")) "")
v v
(maybe GHCupInternal IsolateDir isolateDir) (maybe GHCupInternal IsolateDir isolateDir)
forceInstall forceInstall

View File

@@ -465,22 +465,15 @@ withGHCupTmpDir :: ( MonadReader env m
, MonadMask m , MonadMask m
, MonadIO m) , MonadIO m)
=> m GHCupPath => m GHCupPath
withGHCupTmpDir = do withGHCupTmpDir = snd <$> withRunInIO (\run ->
Settings{keepDirs} <- getSettings run
snd <$> withRunInIO (\run -> $ allocate
run (run mkGhcupTmpDir)
$ allocate (\fp ->
(run mkGhcupTmpDir) handleIO (\e -> run
(\fp -> if -- we don't know whether there was a failure, so can only $ logDebug ("Resource cleanup failed for " <> T.pack (fromGHCupPath fp) <> ", error was: " <> T.pack (displayException e)))
-- decide for 'Always' . removePathForcibly
| keepDirs == Always -> pure () $ fp))
| otherwise -> handleIO (\e -> run
$ logDebug ("Resource cleanup failed for "
<> T.pack (fromGHCupPath fp)
<> ", error was: "
<> T.pack (displayException e)))
. removePathForcibly
$ fp))