fix: Only disable symlinks when truly not supported (#8479)

This commit is contained in:
MkDev11 2026-01-11 10:04:37 -08:00 committed by GitHub
parent 113b6eb103
commit 985cf94bb7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 6 deletions

View File

@ -293,15 +293,21 @@ class DiskActionCacheStore(base: Path, converter: FileConverter) extends Abstrac
IO.createDirectory(outPath.getParent().toFile()) IO.createDirectory(outPath.getParent().toFile())
val result = Retry: val result = Retry:
if Files.exists(outPath) then IO.delete(outPath.toFile()) if Files.exists(outPath) then IO.delete(outPath.toFile())
if symlinkSupported.get() then if symlinkSupported.get() && Files.exists(casFile) then
try Files.createSymbolicLink(outPath, casFile) try Files.createSymbolicLink(outPath, casFile)
catch catch
case e: FileSystemException => case e: FileSystemException =>
if Util.isWindows then val msg = Option(e.getMessage).getOrElse("")
scala.Console.err.println( val isSymlinkNotSupported =
"[info] failed to a create symbolic link. consider enabling Developer Mode" msg.contains("privilege") ||
) msg.contains("Operation not permitted") ||
symlinkSupported.set(false) msg.contains("A required privilege is not held")
if isSymlinkNotSupported then
if Util.isWindows then
scala.Console.err.println(
"[info] failed to a create symbolic link. consider enabling Developer Mode"
)
symlinkSupported.set(false)
copyFile(outPath) copyFile(outPath)
else copyFile(outPath) else copyFile(outPath)
afterFileWrite(ref, result, outputDirectory) afterFileWrite(ref, result, outputDirectory)