1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 00:17:11 -07:00

extend timeout to 2 mins, log error when process times out

This commit is contained in:
Juan Liska 2018-11-23 05:07:34 -06:00
parent 0f0a780b43
commit 0cc2c23a32

View file

@ -79,7 +79,11 @@ open class NewRunCommand(val info: RunCommandInfo) {
val process = pb.start() val process = pb.start()
// Run the command and collect the return code and streams // Run the command and collect the return code and streams
val returnCode = process.waitFor(60, TimeUnit.SECONDS) val processFinished = process.waitFor(120, TimeUnit.SECONDS)
if (!processFinished)
kobaltError("process timed out!")
val input = val input =
if (process.inputStream.available() > 0) fromStream(process.inputStream) if (process.inputStream.available() > 0) fromStream(process.inputStream)
else listOf() else listOf()
@ -92,10 +96,9 @@ open class NewRunCommand(val info: RunCommandInfo) {
// Check to see if the command succeeded // Check to see if the command succeeded
val isSuccess = val isSuccess =
if (info.containsErrors != null) ! info.containsErrors!!(error) if (info.containsErrors != null) ! info.containsErrors!!(error)
else isSuccess(if (info.ignoreExitValue) true else returnCode, input, error) else isSuccess(if (info.ignoreExitValue) true else processFinished, input, error)
if (isSuccess) { if (isSuccess) {
kobaltLog(3, "success so far")
if (!info.useErrorStreamAsErrorIndicator) { if (!info.useErrorStreamAsErrorIndicator) {
info.successCallback(error + input) info.successCallback(error + input)
} else { } else {