From bfe27407ae84376da354c5945a2b971da27431f7 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 10 Nov 2015 18:03:16 -0500 Subject: [PATCH] More explicit handling of jps executable on Windows --- .../gradle/test/ClusterFormationTasks.groovy | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy index b1abc1f966d..31f4cb8c257 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy @@ -286,12 +286,14 @@ class ClusterFormationTasks { onlyIf { pidFile.exists() } // the pid file won't actually be read until execution time, since the read is wrapped within an inner closure of the GString ext.pid = "${ -> pidFile.getText('UTF-8').trim()}" - File jps = getJpsExecutableByName("jps") - if (!jps.exists()) { + File jps + if (Os.isFamily(Os.FAMILY_WINDOWS)) { jps = getJpsExecutableByName("jps.exe") - if (!jps.exists()) { - throw new GradleException("jps executable not found; ensure that you're running Gradle with the JDK rather than the JRE") - } + } else { + jps = getJpsExecutableByName("jps") + } + if (!jps.exists()) { + throw new GradleException("jps executable not found; ensure that you're running Gradle with the JDK rather than the JRE") } commandLine jps, '-l' standardOutput = new ByteArrayOutputStream()