mirror of
https://github.com/corda/corda.git
synced 2025-01-31 00:24:59 +00:00
Windows space in path escape (#2246)
This commit is contained in:
parent
1b49c50c8e
commit
7cfe7f2a78
@ -122,7 +122,7 @@ private class TerminalWindowJavaCommand(jarName: String, dir: File, debugPort: I
|
|||||||
end tell""")
|
end tell""")
|
||||||
}
|
}
|
||||||
OS.WINDOWS -> {
|
OS.WINDOWS -> {
|
||||||
listOf("cmd", "/C", "start ${command.joinToString(" ")}")
|
listOf("cmd", "/C", "start ${command.joinToString(" ") { windowsSpaceEscape(it) }}")
|
||||||
}
|
}
|
||||||
OS.LINUX -> {
|
OS.LINUX -> {
|
||||||
// Start shell to keep window open unless java terminated normally or due to SIGTERM:
|
// Start shell to keep window open unless java terminated normally or due to SIGTERM:
|
||||||
@ -136,12 +136,11 @@ end tell""")
|
|||||||
})
|
})
|
||||||
|
|
||||||
private fun unixCommand() = command.map(::quotedFormOf).joinToString(" ")
|
private fun unixCommand() = command.map(::quotedFormOf).joinToString(" ")
|
||||||
override fun getJavaPath(): String {
|
override fun getJavaPath(): String = File(File(System.getProperty("java.home"), "bin"), "java").path
|
||||||
val path = File(File(System.getProperty("java.home"), "bin"), "java").path
|
|
||||||
// Replace below is to fix an issue with spaces in paths on Windows.
|
// Replace below is to fix an issue with spaces in paths on Windows.
|
||||||
// Quoting the entire path does not work, only the space or directory within the path.
|
// Quoting the entire path does not work, only the space or directory within the path.
|
||||||
return if (os == OS.WINDOWS) path.replace(" ", "\" \"") else path
|
private fun windowsSpaceEscape(s:String) = s.replace(" ", "\" \"")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun quotedFormOf(text: String) = "'${text.replace("'", "'\\''")}'" // Suitable for UNIX shells.
|
private fun quotedFormOf(text: String) = "'${text.replace("'", "'\\''")}'" // Suitable for UNIX shells.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user