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) }