From 869c9f0dc949198e1fd1c4c5ce82c35bb82c7bb2 Mon Sep 17 00:00:00 2001 From: Sergey Pospelov Date: Thu, 18 Aug 2022 13:10:31 +0300 Subject: [PATCH] Fix the child process debug commands order --- .../instrumentation/process/ChildProcessRunner.kt | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/process/ChildProcessRunner.kt b/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/process/ChildProcessRunner.kt index f0ab31e0b4..aca367360d 100644 --- a/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/process/ChildProcessRunner.kt +++ b/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/process/ChildProcessRunner.kt @@ -21,16 +21,11 @@ private var processSeqN = 0 class ChildProcessRunner { private val cmds: List by lazy { - val debugCmd = if (Settings.runChildProcessWithDebug) { - listOf(DEBUG_RUN_CMD) - } else { - emptyList() - } - - listOf( - JdkInfoService.provide().path.resolve("bin${File.separatorChar}java").toString(), - "-javaagent:$jarFile", "-ea", "-jar", "$jarFile" - ) + debugCmd + val pathToJava = JdkInfoService.provide().path + val debugCmd = listOfNotNull(DEBUG_RUN_CMD.takeIf { Settings.runChildProcessWithDebug }) + listOf(pathToJava.resolve("bin${File.separatorChar}java").toString()) + + debugCmd + + listOf("-javaagent:$jarFile", "-ea", "-jar", "$jarFile") } var errorLogFile: File = NULL_FILE