From cdd6b4cce351483c2125a43afa2ddef7cb36206c Mon Sep 17 00:00:00 2001 From: Vladislav Artiukhov Date: Mon, 28 Oct 2024 16:44:55 +0200 Subject: [PATCH] fix: quote compilers' filepaths with "" for Windows --- .../research/testspark/core/test/java/JavaTestCompiler.kt | 5 ++++- .../testspark/core/test/kotlin/KotlinTestCompiler.kt | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/org/jetbrains/research/testspark/core/test/java/JavaTestCompiler.kt b/core/src/main/kotlin/org/jetbrains/research/testspark/core/test/java/JavaTestCompiler.kt index fb2bd055c..483ac90a6 100644 --- a/core/src/main/kotlin/org/jetbrains/research/testspark/core/test/java/JavaTestCompiler.kt +++ b/core/src/main/kotlin/org/jetbrains/research/testspark/core/test/java/JavaTestCompiler.kt @@ -42,12 +42,15 @@ class JavaTestCompiler( override fun compileCode(path: String, projectBuildPath: String, workingDir: String): ExecutionResult { val classPaths = "\"${getClassPaths(projectBuildPath)}\"" // compile file + // See: https://github.com/JetBrains-Research/TestSpark/issues/402 + val javac = if (DataFilesUtil.isWindows()) "\"$javac\"" else "'$javac'" + val executionResult = CommandLineRunner.run( arrayListOf( /** * Filepath may contain spaces, so we need to wrap it in quotes. */ - "'$javac'", + javac, "-cp", classPaths, path, diff --git a/core/src/main/kotlin/org/jetbrains/research/testspark/core/test/kotlin/KotlinTestCompiler.kt b/core/src/main/kotlin/org/jetbrains/research/testspark/core/test/kotlin/KotlinTestCompiler.kt index 6d4c9dfbc..f7e38ea81 100644 --- a/core/src/main/kotlin/org/jetbrains/research/testspark/core/test/kotlin/KotlinTestCompiler.kt +++ b/core/src/main/kotlin/org/jetbrains/research/testspark/core/test/kotlin/KotlinTestCompiler.kt @@ -56,12 +56,15 @@ class KotlinTestCompiler( val classPaths = "\"${getClassPaths(projectBuildPath)}\"" // Compile file + // See: https://github.com/JetBrains-Research/TestSpark/issues/402 + val kotlinc = if (DataFilesUtil.isWindows()) "\"$kotlinc\"" else "'$kotlinc'" + val executionResult = CommandLineRunner.run( arrayListOf( /** * Filepath may contain spaces, so we need to wrap it in quotes. */ - "'$kotlinc'", + kotlinc, "-cp", classPaths, path,