From f15ee9fa54d7ab2d9b839f7274457ba3e3e1906f Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Sat, 28 Nov 2015 17:05:11 -0800 Subject: [PATCH] Build: Move debug options setting to before command line is logged Currently if running with --info, the command line for ES, along with env vars, are logged before they may be ammended to add debug options. This moves the adding JAVA_OPTS to before we print the command. --- .../gradle/test/ClusterFormationTasks.groovy | 14 +++++++------- 1 file changed, 7 insertions(+), 7 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 a3c06e0444c..f74a60f0709 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy @@ -296,13 +296,6 @@ class ClusterFormationTasks { // this closure is converted into ant nodes by groovy's AntBuilder Closure antRunner = { AntBuilder ant -> - // we must add debug options inside the closure so the config is read at execution time, as - // gradle task options are not processed until the end of the configuration phase - if (node.config.debug) { - println 'Running elasticsearch in debug mode, suspending until connected on port 8000' - node.env['JAVA_OPTS'] = '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000' - } - // Due to how ant exec works with the spawn option, we lose all stdout/stderr from the // process executed. To work around this, when spawning, we wrap the elasticsearch start // command inside another shell script, which simply internally redirects the output @@ -334,6 +327,13 @@ class ClusterFormationTasks { // this closure is the actual code to run elasticsearch Closure elasticsearchRunner = { + // we must add debug options inside the closure so the config is read at execution time, as + // gradle task options are not processed until the end of the configuration phase + if (node.config.debug) { + println 'Running elasticsearch in debug mode, suspending until connected on port 8000' + node.env['JAVA_OPTS'] = '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000' + } + node.getCommandString().eachLine { line -> logger.info(line) } if (logger.isInfoEnabled() || node.config.daemonize == false) {