Fixed out-of-process compiler execution if project directy is absent
If project directory does not exist and out-of-process execution is used the file with compiler arguments should be created in project directory (if exists) or in temp directory. #KT-43740 Fixed
This commit is contained in:
+6
-2
@@ -126,8 +126,12 @@ internal fun runToolInSeparateProcess(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun writeArgumentsToFile(directory: File, argsArray: Array<String>): File {
|
private fun writeArgumentsToFile(directory: File, argsArray: Array<String>): File {
|
||||||
val compilerOptions =
|
val prefix = LocalDateTime.now().format(DateTimeFormatter.BASIC_ISO_DATE) + "_"
|
||||||
Files.createTempFile(directory.toPath(), LocalDateTime.now().format(DateTimeFormatter.BASIC_ISO_DATE) + "_", ".compiler.options").toFile()
|
val suffix = ".compiler.options"
|
||||||
|
val compilerOptions = if (directory.exists())
|
||||||
|
Files.createTempFile(directory.toPath(), prefix, suffix).toFile()
|
||||||
|
else
|
||||||
|
Files.createTempFile(prefix, suffix).toFile()
|
||||||
compilerOptions.deleteOnExit()
|
compilerOptions.deleteOnExit()
|
||||||
compilerOptions.writeText(argsArray.joinToString(" ") { "\"${StringEscapeUtils.escapeJava(it)}\"" })
|
compilerOptions.writeText(argsArray.joinToString(" ") { "\"${StringEscapeUtils.escapeJava(it)}\"" })
|
||||||
return compilerOptions
|
return compilerOptions
|
||||||
|
|||||||
Reference in New Issue
Block a user