You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
553 B
Kotlin
16 lines
553 B
Kotlin
package me.eater.hefbrug.access
|
|
|
|
import me.eater.hefbrug.utils.escape
|
|
|
|
data class ExecutionOutput(val command: ExecutionCommand, val exitCode: Int, val stdout: String, val stderr: String) {
|
|
fun orThrow() {
|
|
if (exitCode != 0) {
|
|
throw ExecutionException(
|
|
"Execution of [${command.command.joinToString(" ") { it.escape() }}] failed with exit code $exitCode",
|
|
this
|
|
)
|
|
}
|
|
}
|
|
|
|
class ExecutionException(message: String?, val output: ExecutionOutput) : RuntimeException(message)
|
|
} |