Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2847,12 +2847,11 @@ private static Set<Entry<String, String>> getPropertiesSafe() {
private static List<String> getOpenedDescriptors() {
List<String> paths = new ArrayList<>();
Path fd = Paths.get("/proc/self/fd/");
try(DirectoryStream<Path> directoryStream = Files.newDirectoryStream(fd)){
directoryStream.forEach(f -> {
try {
paths.add(Files.isSymbolicLink(f)? Files.readSymbolicLink(f).toString() : f.toString());
} catch (IOException e) {
e.printStackTrace();
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(fd)) {
directoryStream.forEach(path -> {
String resolvedPath = resolveSymLink(path);
if (isTestRelatedFileDescriptor(resolvedPath)) {
paths.add(resolvedPath);
}
});
} catch (IOException e1) {
Expand All @@ -2865,6 +2864,22 @@ private static List<String> getOpenedDescriptors() {
return paths;
}

private static boolean isTestRelatedFileDescriptor(String fileDescriptorPath) {
// Do not consider file descriptors of Maven artifacts that are currently opened
// by other Maven plugins executed in parallel build (such as parallel
// compilation of the swt.tools bundle etc.)
return fileDescriptorPath != null && !fileDescriptorPath.contains(".m2")
&& !fileDescriptorPath.contains("target/classes");
}

private static String resolveSymLink(Path path) {
try {
return Files.isSymbolicLink(path) ? Files.readSymbolicLink(path).toString() : path.toString();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}

private static void processUiEvents() {
Display display = Display.getCurrent();
Expand Down
Loading