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