[gradle-plugin] Escape system properties on Windows (#1849)
This commit is contained in:
+15
-1
@@ -71,6 +71,15 @@ internal abstract class KonanCliRunner(
|
|||||||
|
|
||||||
override val environment = mutableMapOf("LIBCLANG_DISABLE_CRASH_RECOVERY" to "1")
|
override val environment = mutableMapOf("LIBCLANG_DISABLE_CRASH_RECOVERY" to "1")
|
||||||
|
|
||||||
|
private fun String.escapeQuotes() = replace("\"", "\\\"")
|
||||||
|
|
||||||
|
private fun List<Pair<String, String>>.escapeQuotesForWindows() =
|
||||||
|
if (HostManager.hostIsMingw) {
|
||||||
|
map { (key, value) -> key.escapeQuotes() to value.escapeQuotes() }
|
||||||
|
} else {
|
||||||
|
this
|
||||||
|
}
|
||||||
|
|
||||||
override fun run(args: List<String>) {
|
override fun run(args: List<String>) {
|
||||||
project.logger.info("Run tool: $toolName with args: ${args.joinToString(separator = " ")}")
|
project.logger.info("Run tool: $toolName with args: ${args.joinToString(separator = " ")}")
|
||||||
if (classpath.isEmpty) {
|
if (classpath.isEmpty) {
|
||||||
@@ -83,7 +92,12 @@ internal abstract class KonanCliRunner(
|
|||||||
spec.main = mainClass
|
spec.main = mainClass
|
||||||
spec.classpath = classpath
|
spec.classpath = classpath
|
||||||
spec.jvmArgs(jvmArgs)
|
spec.jvmArgs(jvmArgs)
|
||||||
spec.systemProperties(System.getProperties().map { (k, v) -> k.toString() to v }.toMap())
|
spec.systemProperties(
|
||||||
|
System.getProperties()
|
||||||
|
.map { (k, v) -> k.toString() to v.toString() }
|
||||||
|
.escapeQuotesForWindows()
|
||||||
|
.toMap()
|
||||||
|
)
|
||||||
spec.systemProperties(additionalSystemProperties)
|
spec.systemProperties(additionalSystemProperties)
|
||||||
spec.args(listOf(toolName) + args)
|
spec.args(listOf(toolName) + args)
|
||||||
blacklistEnvironment.forEach { spec.environment.remove(it) }
|
blacklistEnvironment.forEach { spec.environment.remove(it) }
|
||||||
|
|||||||
Reference in New Issue
Block a user