mirror of
https://github.com/corda/corda.git
synced 2025-06-11 20:01:46 +00:00
runnodes: Fix runnodes on Linux, fix nodeName
This commit is contained in:
@ -59,21 +59,26 @@ private fun execJar(jarName: String, dir: File, args: List<String> = listOf()):
|
|||||||
|
|
||||||
private fun execJarInTerminalWindow(jarName: String, dir: File, args: List<String> = listOf()): Process {
|
private fun execJarInTerminalWindow(jarName: String, dir: File, args: List<String> = listOf()): Process {
|
||||||
val javaCmd = "java -jar $jarName " + args.joinToString(" ") { it }
|
val javaCmd = "java -jar $jarName " + args.joinToString(" ") { it }
|
||||||
val nodeName = dir.toPath().fileName + " " + jarName
|
val nodeName = "${dir.toPath().fileName} $jarName"
|
||||||
val osName = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH)
|
val osName = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH)
|
||||||
val cmd = if ((osName.indexOf("mac") >= 0) || (osName.indexOf("darwin") >= 0)) {
|
val builder = if ((osName.indexOf("mac") >= 0) || (osName.indexOf("darwin") >= 0)) {
|
||||||
"""osascript -e "tell app "Terminal
|
ProcessBuilder(
|
||||||
|
"osascript", "-e",
|
||||||
|
"""tell app "Terminal
|
||||||
activate
|
activate
|
||||||
tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down
|
tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down
|
||||||
delay 0.5
|
delay 0.5
|
||||||
do script "bash -c 'cd $dir; /usr/libexec/java_home -v 1.8 --exec $javaCmd && exit'" in window 1"
|
do script "bash -c 'cd $dir; /usr/libexec/java_home -v 1.8 --exec $javaCmd && exit'" in window 1"""
|
||||||
"""
|
)
|
||||||
} else if (osName.indexOf("win") >= 0) {
|
} else if (osName.indexOf("win") >= 0) {
|
||||||
"""cmd /C "start $javaCmd""""
|
ProcessBuilder(
|
||||||
|
"cmd", "/C", "start $javaCmd"
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
// Assume Linux
|
// Assume Linux
|
||||||
"""xterm -T "$nodeName" -e $javaCmd"""
|
ProcessBuilder(
|
||||||
|
"xterm", "-T", nodeName, "-e", javaCmd
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
return builder.directory(dir).start()
|
||||||
return Runtime.getRuntime().exec(cmd, null, dir)
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user