Skip to content

Commit b7907a2

Browse files
Fix Gradle Daemon process detection (#7524)
1 parent 5c1271d commit b7907a2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/utils/ProcessHierarchyUtils.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ private static boolean isMavenParent() {
3838
}
3939

4040
private static boolean isGradleDaemon() {
41-
return ClassLoader.getSystemClassLoader().getResource("org/gradle/launcher/daemon/") != null;
41+
return ClassLoader.getSystemClassLoader()
42+
.getResource("org/gradle/launcher/daemon/bootstrap/GradleDaemon.class")
43+
!= null
44+
// double-check this is not a Gradle Worker
45+
&& System.getProperties().getProperty("org.gradle.internal.worker.tmpdir") == null;
4246
}
4347

4448
public static long getParentSessionId() {

0 commit comments

Comments
 (0)