Fix upgradeGHCup

File needs to be unlinked first, because it might
potentially be in use.
This commit is contained in:
Julian Ospald 2020-04-12 18:54:03 +02:00
parent df9dd0e785
commit d2efb504b9
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28

View File

@ -697,10 +697,15 @@ upgradeGHCup dls mtarget = do
case mtarget of
Nothing -> do
dest <- liftIO $ ghcupBinDir
liftIO $ hideError NoSuchThing $ deleteFile (dest </> fn)
handleIO (throwE . CopyError . show) $ liftIO $ copyFile p
(dest </> fn)
Overwrite
Just fullDest -> liftIO $ copyFile p fullDest Overwrite
Just fullDest -> do
liftIO $ hideError NoSuchThing $ deleteFile fullDest
handleIO (throwE . CopyError . show) $ liftIO $ copyFile p
fullDest
Overwrite
pure latestVer