Skip to content

Commit

Permalink
Resolving relative java path provided to EvoSuite
Browse files Browse the repository at this point in the history
  • Loading branch information
Hello-zoka committed Nov 5, 2024
1 parent 5ecaafb commit aecd0a8
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,24 @@ class EvoSuiteProcessManager(
if (ToolUtils.isProcessStopped(errorMonitor, indicator)) return null

val regex = Regex("version \"(.*?)\"")

// Resolving relative java path, if it's possible
if (evoSuiteSettingsState.javaPath.startsWith("~/")) {
val pathEvalCommandResult =
CommandLineRunner.run(arrayListOf("eval", "ls", evoSuiteSettingsState.javaPath))
if (!pathEvalCommandResult.isSuccessful()) {
evoSuiteErrorManager.errorProcess(
EvoSuiteMessagesBundle.get("incorrectJavaVersion"),
project,
errorMonitor
)
return null
}
evoSuiteSettingsState.javaPath = pathEvalCommandResult.executionMessage.trim('\n')
}

val versionCommandResult = CommandLineRunner.run(arrayListOf(evoSuiteSettingsState.javaPath, "-version"))

log.info("Version command result: exit code '${versionCommandResult.exitCode}', message '${versionCommandResult.executionMessage}'")
val version = regex.find(versionCommandResult.executionMessage)
?.groupValues
Expand Down

0 comments on commit aecd0a8

Please sign in to comment.