[Git][ghc/ghc][master] Hadrian: Delete target symlink in createFileLinkUntracked

Marge Bot gitlab at gitlab.haskell.org
Fri Jun 7 14:24:42 UTC 2019



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
9bb58799 by Ben Gamari at 2019-06-07T14:24:38Z
Hadrian: Delete target symlink in createFileLinkUntracked

Previously createFileLinkUntracked would fail if the symlink already
existed.

- - - - -


1 changed file:

- hadrian/src/Hadrian/Utilities.hs


Changes:

=====================================
hadrian/src/Hadrian/Utilities.hs
=====================================
@@ -34,6 +34,7 @@ module Hadrian.Utilities (
     Dynamic, fromDynamic, toDyn, TypeRep, typeOf
     ) where
 
+import Control.Applicative
 import Control.Monad.Extra
 import Data.Char
 import Data.Dynamic (Dynamic, fromDynamic, toDyn)
@@ -296,7 +297,9 @@ createFileLinkUntracked linkTarget link = do
     let dir = takeDirectory link
     liftIO $ IO.createDirectoryIfMissing True dir
     putProgressInfo =<< renderCreateFileLink linkTarget link
-    quietly . liftIO $ IO.createFileLink linkTarget link
+    quietly . liftIO $ do
+        IO.removeFile link <|> return ()
+        IO.createFileLink linkTarget link
 
 -- | Link a file tracking the link target. Create the target directory if
 -- missing.



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/9bb58799d2ce58f6aef772df79ad26210403aded

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/9bb58799d2ce58f6aef772df79ad26210403aded
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190607/6868b894/attachment-0001.html>


More information about the ghc-commits mailing list