Merge pull request #14665 from jasontedor/windows-jps-executable-name
Get correct jps path on Windows
This commit is contained in:
commit
4cd8d0a815
|
@ -286,9 +286,12 @@ class ClusterFormationTasks {
|
||||||
onlyIf { pidFile.exists() }
|
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
|
// 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()}"
|
ext.pid = "${ -> pidFile.getText('UTF-8').trim()}"
|
||||||
File jps = Paths.get(Jvm.current().javaHome.toString(), "bin/jps").toFile()
|
File jps = getJpsExecutableByName("jps")
|
||||||
if (!jps.exists()) {
|
if (!jps.exists()) {
|
||||||
throw new GradleException("jps executable not found; ensure that you're running Gradle with the JDK rather than the JRE")
|
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")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
commandLine jps, '-l'
|
commandLine jps, '-l'
|
||||||
standardOutput = new ByteArrayOutputStream()
|
standardOutput = new ByteArrayOutputStream()
|
||||||
|
@ -308,6 +311,10 @@ class ClusterFormationTasks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static File getJpsExecutableByName(String jpsExecutableName) {
|
||||||
|
return Paths.get(Jvm.current().javaHome.toString(), "bin/" + jpsExecutableName).toFile()
|
||||||
|
}
|
||||||
|
|
||||||
/** Adds a task to kill an elasticsearch node with the given pidfile */
|
/** Adds a task to kill an elasticsearch node with the given pidfile */
|
||||||
static Task configureStopTask(String name, Project project, Object depends, File pidFile) {
|
static Task configureStopTask(String name, Project project, Object depends, File pidFile) {
|
||||||
return project.tasks.create(name: name, type: Exec, dependsOn: depends) {
|
return project.tasks.create(name: name, type: Exec, dependsOn: depends) {
|
||||||
|
|
Loading…
Reference in New Issue