Skip to content

Commit

Permalink
use exit code rather than stderr contents to determine if command exe…
Browse files Browse the repository at this point in the history
…cution does not succeed
  • Loading branch information
hpratt committed Oct 22, 2023
1 parent e50effc commit 643b1ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugins {
}

group = "io.krews"
version = "0.14.12"
version = "0.14.13"

repositories {
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/krews/misc/Shell.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ class CommandExecutor(private val sshConfig: SshConfig? = null) {
log.info { "Command results:\n$result" }

val error = process.errorStream.reader().readText()
if (error.isNotBlank()) throw Exception("Encountered error during command execution: $error")
val exitCode = process.waitFor()
if (exitCode != 0) throw Exception("Encountered error during command execution: $error")
return result
}

}
}

0 comments on commit 643b1ff

Please sign in to comment.