mirror of
https://github.com/corda/corda.git
synced 2024-12-28 00:38:55 +00:00
Switch from Runtime.exec() to ProcessBuilder.
This commit is contained in:
parent
166cbbf2e5
commit
94747dcddf
@ -18,16 +18,16 @@ class Explorer(val explorerController: ExplorerController) : AutoCloseable {
|
||||
return
|
||||
}
|
||||
|
||||
val p = explorerController.execute(
|
||||
config.explorerDir,
|
||||
val p = explorerController.process(
|
||||
"--host=localhost",
|
||||
"--port=${config.artemisPort}",
|
||||
"--username=${config.user["user"]}",
|
||||
"--password=${config.user["password"]}",
|
||||
"--certificatesDir=${config.ssl.certificatesDirectory}",
|
||||
"--keyStorePassword=${config.ssl.keyStorePassword}",
|
||||
"--trustStorePassword=${config.ssl.trustStorePassword}"
|
||||
)
|
||||
"--trustStorePassword=${config.ssl.trustStorePassword}")
|
||||
.directory(explorerDir)
|
||||
.start()
|
||||
process = p
|
||||
|
||||
log.info("Launched Node Explorer for '{}'", config.legalName)
|
||||
|
@ -1,8 +1,6 @@
|
||||
package net.corda.demobench.model
|
||||
|
||||
import tornadofx.Controller
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
|
||||
class ExplorerController : Controller() {
|
||||
|
||||
@ -13,7 +11,7 @@ class ExplorerController : Controller() {
|
||||
log.info("Explorer JAR: $explorerPath")
|
||||
}
|
||||
|
||||
internal fun execute(cwd: Path, vararg args: String) = jvm.execute(explorerPath, cwd, *args)
|
||||
internal fun process(vararg args: String) = jvm.processFor(explorerPath, *args)
|
||||
|
||||
fun explorer() = Explorer(this)
|
||||
|
||||
|
@ -18,8 +18,8 @@ class JVMConfig : Controller() {
|
||||
return arrayOf(javaPath.toString(), "-jar", jarPath.toString(), *args)
|
||||
}
|
||||
|
||||
fun execute(jarPath: Path, cwd: Path, vararg args: String): Process {
|
||||
return Runtime.getRuntime().exec(commandFor(jarPath, *args), null, cwd.toFile())
|
||||
fun processFor(jarPath: Path, vararg args: String): ProcessBuilder {
|
||||
return ProcessBuilder(commandFor(jarPath, *args).toList())
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,9 @@ class WebServer(val webServerController: WebServerController) : AutoCloseable {
|
||||
return
|
||||
}
|
||||
|
||||
val p = webServerController.execute(config.nodeDir)
|
||||
val p = webServerController.process()
|
||||
.directory(nodeDir)
|
||||
.start()
|
||||
process = p
|
||||
|
||||
log.info("Launched Web Server for '{}'", config.legalName)
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.corda.demobench.model
|
||||
|
||||
import tornadofx.Controller
|
||||
import java.nio.file.Path
|
||||
|
||||
class WebServerController : Controller() {
|
||||
|
||||
@ -12,7 +11,7 @@ class WebServerController : Controller() {
|
||||
log.info("Web Server JAR: $cordaPath")
|
||||
}
|
||||
|
||||
internal fun execute(cwd: Path) = jvm.execute(cordaPath, cwd, "--webserver")
|
||||
internal fun process() = jvm.processFor(cordaPath, "--webserver")
|
||||
|
||||
fun webServer() = WebServer(this)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user