Skip to content

Commit 8684b76

Browse files
authored
Ignore errors syncing ephemeral files in test clusters (#82154) (#82223)
1 parent 49fb505 commit 8684b76

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

build-tools/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
import java.io.UncheckedIOException;
6363
import java.nio.charset.StandardCharsets;
6464
import java.nio.file.Files;
65+
import java.nio.file.NoSuchFileException;
6566
import java.nio.file.Path;
6667
import java.nio.file.StandardCopyOption;
6768
import java.nio.file.StandardOpenOption;
@@ -1207,11 +1208,6 @@ private void sync(Path sourceRoot, Path destinationRoot, BiConsumer<Path, Path>
12071208
throw new UncheckedIOException("Can't create directory " + destination.getParent(), e);
12081209
}
12091210
} else {
1210-
// Ignore these files that are sometimes let behind by the JVM
1211-
if (relativeDestination.toFile().getName().startsWith(".attach_pid")) {
1212-
return;
1213-
}
1214-
12151211
try {
12161212
Files.createDirectories(destination.getParent());
12171213
} catch (IOException e) {
@@ -1220,6 +1216,11 @@ private void sync(Path sourceRoot, Path destinationRoot, BiConsumer<Path, Path>
12201216
syncMethod.accept(destination, source);
12211217
}
12221218
});
1219+
} catch (NoSuchFileException e) {
1220+
// Ignore these files that are sometimes left behind by the JVM
1221+
if (e.getFile() == null || e.getFile().contains(".attach_pid") == false) {
1222+
throw new UncheckedIOException(e);
1223+
}
12231224
} catch (IOException e) {
12241225
throw new UncheckedIOException("Can't walk source " + sourceRoot, e);
12251226
}

0 commit comments

Comments
 (0)