Get more input only if process is alive
Change-Id: I37d3b29258def56008ea9cae6eff1f1c85d9f097
diff --git a/app/src/main/kotlin/de/ids_mannheim/korapxmltools/AnnotationWorkerPool.kt b/app/src/main/kotlin/de/ids_mannheim/korapxmltools/AnnotationWorkerPool.kt
index 79a862d..d601e4a 100644
--- a/app/src/main/kotlin/de/ids_mannheim/korapxmltools/AnnotationWorkerPool.kt
+++ b/app/src/main/kotlin/de/ids_mannheim/korapxmltools/AnnotationWorkerPool.kt
@@ -97,7 +97,7 @@
}
printOutput(output.toString())
output.clear()
- if (!inputGotEof) {
+ if (!inputGotEof && process.isAlive) {
LOGGER.info("Worker $it waiting for more output")
sleep(10)
}
@@ -175,6 +175,7 @@
}
}
+
fun main() {
val command = "cat"
val numWorkers = 3
diff --git a/app/src/test/kotlin/de/ids_mannheim/korapxmltools/KorapXml2ConlluTest.kt b/app/src/test/kotlin/de/ids_mannheim/korapxmltools/KorapXml2ConlluTest.kt
index a34166c..a4de206 100644
--- a/app/src/test/kotlin/de/ids_mannheim/korapxmltools/KorapXml2ConlluTest.kt
+++ b/app/src/test/kotlin/de/ids_mannheim/korapxmltools/KorapXml2ConlluTest.kt
@@ -162,8 +162,8 @@
outContent.toString(),
"axtomatiqxe"
)
- assertTrue("Annotated CoNLL-U should have at least as many lines as the original, but only has ${outContent.toString().count { it == '\n'}} lines",
- { outContent.toString().count { it == '\n'} >= 61511 })
+ assertTrue("Annotated CoNLL-U should have at least as many lines as the original, but only has ${outContent.toString().count { it == '\n'}} lines"
+ ) { outContent.toString().count { it == '\n' } >= 61511 }
}
@Test