Skip to content

[windows] Fix file/dir removal

Processes, such as HLS, may block files inside the GHC dir, causing partial removal, leaving ghcup in a half-broken state:

p.exe ...
[ Warn  ] New GHC version available: 9.0.1. To upgrade, run 'ghcup install ghc 9.0.1'
[ Warn  ] WARNING: This will remove GHCup and all installed components from your system.
[ Warn  ] Wating 10 seconds before commencing, if you want to cancel it, now would be the time.
[ Info  ] Initiating Nuclear Sequence 🚀🚀🚀
[ Info  ] Nuking in 3...2...1
[ Info  ] Removing ghc symlinks
[ Info  ] Removing ghc-x.y.z symlinks
[ Info  ] Removing/rewiring ghc-x.y symlinks
[ Info  ] Removing directory recursively: D:\Haskell\ghcup\ghc\8.10.5
ghcup: D:\Haskell\ghcup\ghc\8.10.5\mingw\bin\libwinpthread-1.dll: removePathForcibly:removePathForcibly:removePathForcibly:removePathForcibly:DeleteFile "\\\\?\\D:\\Haskell\\ghcup\\ghc\\8.10.5\\mingw\\bin\\libwinpthread-1.dll": permission denied (Access is denied.)
  arjun_: hold on ghcup is now stuck in a weird state. it wont uninstall "cant find some dir" and wont re-install because it thinks it's already there.

The solution is to:

  1. move files/folders to a temp directory (on the same device) first
  2. Try to delete them from there
  3. If it fails, the next ghcup invocation can try to delete them again in a separate thread
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information