Skip to content

Commit 534b610

Browse files
authored
Merge pull request #508 from pabl0rg/fix-separate-kotlinc-errors-not-caught
extend timeout, restore process exitValue check
2 parents 91eefc9 + 744a730 commit 534b610

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/NewRunCommand.kt

+6-3
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,14 @@ open class NewRunCommand(val info: RunCommandInfo) {
7979
val process = pb.start()
8080

8181
// Run the command and collect the return code and streams
82-
val processFinished = process.waitFor(120, TimeUnit.SECONDS)
83-
82+
val processFinished = process.waitFor(240, TimeUnit.SECONDS)
8483
if (!processFinished)
8584
kobaltError("process timed out!")
8685

86+
val processExitedOk = process.exitValue() == 0
87+
if (!processExitedOk)
88+
kobaltError("process returned non-zero code!")
89+
8790
val input =
8891
if (process.inputStream.available() > 0) fromStream(process.inputStream)
8992
else listOf()
@@ -96,7 +99,7 @@ open class NewRunCommand(val info: RunCommandInfo) {
9699
// Check to see if the command succeeded
97100
val isSuccess =
98101
if (info.containsErrors != null) ! info.containsErrors!!(error)
99-
else isSuccess(if (info.ignoreExitValue) true else processFinished, input, error)
102+
else isSuccess(processFinished && if (info.ignoreExitValue) true else processExitedOk, input, error)
100103

101104
if (isSuccess) {
102105
if (!info.useErrorStreamAsErrorIndicator) {

0 commit comments

Comments
 (0)