This commit is contained in:
@@ -9,6 +9,8 @@ import com.github.ajalt.clikt.parameters.options.default
|
|||||||
import com.github.ajalt.clikt.parameters.options.option
|
import com.github.ajalt.clikt.parameters.options.option
|
||||||
import com.github.ajalt.clikt.parameters.types.int
|
import com.github.ajalt.clikt.parameters.types.int
|
||||||
|
|
||||||
|
const val SPARK = "/jars/spark.jar"
|
||||||
|
|
||||||
class ProfilerCommand: CliktCommand("profiler") {
|
class ProfilerCommand: CliktCommand("profiler") {
|
||||||
val pid by argument().help("Process id").int().optional()
|
val pid by argument().help("Process id").int().optional()
|
||||||
val port by option("--port", "-p").int().default(8543)
|
val port by option("--port", "-p").int().default(8543)
|
||||||
@@ -16,7 +18,7 @@ class ProfilerCommand: CliktCommand("profiler") {
|
|||||||
override fun run() {
|
override fun run() {
|
||||||
if (pid != null) {
|
if (pid != null) {
|
||||||
ProcessBuilder()
|
ProcessBuilder()
|
||||||
.command("java", "-jar", "/jars/spark.java", pid.toString(), "port=$port")
|
.command("java", "-jar", SPARK, pid.toString(), "port=$port")
|
||||||
.start()
|
.start()
|
||||||
.waitFor()
|
.waitFor()
|
||||||
|
|
||||||
@@ -27,7 +29,7 @@ class ProfilerCommand: CliktCommand("profiler") {
|
|||||||
.waitFor()
|
.waitFor()
|
||||||
} else {
|
} else {
|
||||||
ProcessBuilder()
|
ProcessBuilder()
|
||||||
.command("java", "-jar", "/jars/spark.java")
|
.command("java", "-jar", SPARK)
|
||||||
.inheritIO()
|
.inheritIO()
|
||||||
.start()
|
.start()
|
||||||
.waitFor()
|
.waitFor()
|
||||||
|
|||||||
Reference in New Issue
Block a user