mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Timeout when running commands.
This commit is contained in:
parent
21eaa3e414
commit
abd768fbc6
1 changed files with 3 additions and 2 deletions
|
@ -4,6 +4,7 @@ import java.io.BufferedReader
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.io.InputStreamReader
|
import java.io.InputStreamReader
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
open class RunCommand(val command: String) {
|
open class RunCommand(val command: String) {
|
||||||
val defaultSuccess = { output: List<String> -> }
|
val defaultSuccess = { output: List<String> -> }
|
||||||
|
@ -30,8 +31,8 @@ open class RunCommand(val command: String) {
|
||||||
pbEnv.put(it.key, it.value)
|
pbEnv.put(it.key, it.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val passed = process.waitFor()//(2, TimeUnit.SECONDS)
|
val callSucceeded = process.waitFor(30, TimeUnit.SECONDS)
|
||||||
val callSucceeded = if (passed == 0) true else false
|
// val callSucceeded = if (passed == 0) true else false
|
||||||
if (callSucceeded) {
|
if (callSucceeded) {
|
||||||
successCb(fromStream(process.inputStream))
|
successCb(fromStream(process.inputStream))
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue