@ -182,29 +182,7 @@ class DevCommand : CliktCommand("dev") {
|
|||||||
echo(command.joinToString(" "))
|
echo(command.joinToString(" "))
|
||||||
val process = ProcessBuilder(
|
val process = ProcessBuilder(
|
||||||
*command
|
*command
|
||||||
).directory(serverDir).start()
|
).directory(serverDir).inheritIO().start()
|
||||||
|
|
||||||
val input = launch {
|
|
||||||
while (process.isAlive) {
|
|
||||||
process.inputStream.transferTo(System.out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val error = launch {
|
|
||||||
while (process.isAlive) {
|
|
||||||
process.errorStream.transferTo(System.err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val console = launch {
|
|
||||||
while (process.isAlive) {
|
|
||||||
System.`in`.transferTo(process.outputStream)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
process.waitFor()
|
process.waitFor()
|
||||||
input.cancel()
|
|
||||||
error.cancel()
|
|
||||||
console.cancel()
|
|
||||||
joinAll(input, error, console)
|
|
||||||
echo("Process finished with exit code ${process.exitValue()}")
|
|
||||||
process.errorStream.transferTo(System.err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user