Fix unmigrated offer

This commit is contained in:
Mygod
2021-05-07 15:54:44 -04:00
parent 491f814f94
commit 8a99c9594d

View File

@@ -102,15 +102,21 @@ class ProcessListener(private val terminateRegex: Regex,
try { try {
launch(parent) { launch(parent) {
try { try {
process.inputStream.bufferedReader().forEachLine { process.inputStream.bufferedReader().useLines {
trySend(ProcessData.StdoutLine(it)).onClosed { return@forEachLine }.onFailure { throw it!! } for (line in it) {
if (terminateRegex.containsMatchIn(it)) process.destroy() trySend(ProcessData.StdoutLine(line)).onClosed { return@useLines }.onFailure { throw it!! }
if (terminateRegex.containsMatchIn(line)) process.destroy()
}
} }
} catch (_: InterruptedIOException) { } } catch (_: InterruptedIOException) { }
} }
launch(parent) { launch(parent) {
try { try {
process.errorStream.bufferedReader().forEachLine { check(offer(ProcessData.StderrLine(it))) } process.errorStream.bufferedReader().useLines {
for (line in it) trySend(ProcessData.StdoutLine(line)).onClosed {
return@useLines
}.onFailure { throw it!! }
}
} catch (_: InterruptedIOException) { } } catch (_: InterruptedIOException) { }
} }
launch(parent) { launch(parent) {