Fix matching error in IpMonitor
This commit is contained in:
@@ -53,7 +53,7 @@ abstract class IpMonitor : Runnable {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
process.inputStream.bufferedReader().forEachLine {
|
process.inputStream.bufferedReader().forEachLine {
|
||||||
if (errorMatcher.matches(it)) {
|
if (errorMatcher.containsMatchIn(it)) {
|
||||||
Timber.w(it)
|
Timber.w(it)
|
||||||
process.destroy() // move on to next mode
|
process.destroy() // move on to next mode
|
||||||
} else processLine(it)
|
} else processLine(it)
|
||||||
@@ -102,7 +102,7 @@ abstract class IpMonitor : Runnable {
|
|||||||
}
|
}
|
||||||
process.inputStream.bufferedReader().useLines {
|
process.inputStream.bufferedReader().useLines {
|
||||||
processLines(it.map { line ->
|
processLines(it.map { line ->
|
||||||
if (errorMatcher.matches(line)) throw IOException(line)
|
if (errorMatcher.containsMatchIn(line)) throw IOException(line)
|
||||||
line
|
line
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -117,15 +117,17 @@ abstract class IpMonitor : Runnable {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
val command = "ip $monitoredObject"
|
val command = "ip $monitoredObject"
|
||||||
RootSession.use {
|
RootSession.use { shell ->
|
||||||
val result = it.execQuiet(command)
|
val result = shell.execQuiet(command)
|
||||||
RootSession.checkOutput(command, result, false)
|
RootSession.checkOutput(command, result, false)
|
||||||
if (result.out.any { errorMatcher.matches(it) }) throw IOException(result.out.joinToString("\n"))
|
if (result.out.any { errorMatcher.containsMatchIn(it) }) {
|
||||||
|
throw IOException(result.out.joinToString("\n"))
|
||||||
|
}
|
||||||
processLines(result.out.asSequence())
|
processLines(result.out.asSequence())
|
||||||
}
|
}
|
||||||
} catch (e: RuntimeException) {
|
} catch (e: RuntimeException) {
|
||||||
app.logEvent("ip_su_poll_failure")
|
app.logEvent("ip_su_poll_failure") { param("cause", e.message.toString()) }
|
||||||
Timber.w(e)
|
Timber.d(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user