From 274f1516bba5de0b28e119d5432c549d9df4ace5 Mon Sep 17 00:00:00 2001 From: Alex Archambault Date: Thu, 10 Apr 2025 18:36:35 +0200 Subject: [PATCH] Work around transient error on Windows Seems the CI works around it fine with retries, but better catch the exception early --- .../client/src/mill/runner/client/JLineNativeLoader.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/runner/client/src/mill/runner/client/JLineNativeLoader.java b/runner/client/src/mill/runner/client/JLineNativeLoader.java index 54476d44fd6..676c1021a28 100644 --- a/runner/client/src/mill/runner/client/JLineNativeLoader.java +++ b/runner/client/src/mill/runner/client/JLineNativeLoader.java @@ -3,6 +3,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.file.AccessDeniedException; import java.nio.file.AtomicMoveNotSupportedException; import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; @@ -82,6 +83,12 @@ void loadSlow() { Files.move(tmpLocation, millJLineNativeLibLocation, StandardCopyOption.ATOMIC_MOVE); } catch (FileAlreadyExistsException ex) { // Ignored, file should have been created by another Mill process + } catch (AccessDeniedException ex) { + if (Files.exists(millJLineNativeLibLocation)) { + // Ignored, file should have been created by another Mill process + } else { + throw new RuntimeException(ex); + } } catch (AtomicMoveNotSupportedException ex) { try { Files.move(tmpLocation, millJLineNativeLibLocation);