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 18beb2497a0e2..96d2592883a3c 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy @@ -690,6 +690,13 @@ class ClusterFormationTasks { env(key: 'JAVA_HOME', value: project.runtimeJavaHome) } node.args.each { arg(value: it) } + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + // Having no TMP on Windows defaults to C:\Windows and permission errors + // Since we configure ant to run with a new environment above, we need to set this to a dir we have access to + File tmpDir = new File(node.baseDir, "tmp") + tmpDir.mkdirs() + env(key: "TMP", value: tmpDir.absolutePath) + } } } diff --git a/distribution/src/bin/elasticsearch b/distribution/src/bin/elasticsearch index 84e14eea3f6f8..6ce76b6cf01a7 100755 --- a/distribution/src/bin/elasticsearch +++ b/distribution/src/bin/elasticsearch @@ -18,7 +18,7 @@ source "`dirname "$0"`"/elasticsearch-env ES_JVM_OPTIONS="$ES_PATH_CONF"/jvm.options JVM_OPTIONS=`"$JAVA" -cp "$ES_CLASSPATH" org.elasticsearch.tools.launchers.JvmOptionsParser "$ES_JVM_OPTIONS"` -ES_JAVA_OPTS="${JVM_OPTIONS//\$\{ES_TMPDIR\}/$ES_TMPDIR} $ES_JAVA_OPTS" +ES_JAVA_OPTS="${JVM_OPTIONS//\"\$\{ES_TMPDIR\}\"/$ES_TMPDIR} $ES_JAVA_OPTS" cd "$ES_HOME" # manual parsing to find out, if process should be detached diff --git a/distribution/src/config/jvm.options b/distribution/src/config/jvm.options index 2b30d6a87b4a1..e7da20dfe7e3e 100644 --- a/distribution/src/config/jvm.options +++ b/distribution/src/config/jvm.options @@ -86,7 +86,7 @@ -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true --Djava.io.tmpdir=${ES_TMPDIR} +-Djava.io.tmpdir="${ES_TMPDIR}" ## heap dumps