diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/Explorer.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/Explorer.kt index 289b71c222..c70fe426ed 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/Explorer.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/Explorer.kt @@ -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) diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/ExplorerController.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/ExplorerController.kt index eaf56e3276..b0325be4b8 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/ExplorerController.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/ExplorerController.kt @@ -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) diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/JVMConfig.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/JVMConfig.kt index 08cc1b812b..4b2eb284db 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/JVMConfig.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/JVMConfig.kt @@ -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()) } } diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/WebServer.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/WebServer.kt index e60c12eff6..1dda1045d1 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/WebServer.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/WebServer.kt @@ -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) diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/WebServerController.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/WebServerController.kt index dd2118bc36..60718e74d4 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/WebServerController.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/WebServerController.kt @@ -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)