Fixed race condition when deleting temporary files

This commit is contained in:
Daniel Wolf 2018-02-18 20:51:50 +01:00
parent 64bdf78b85
commit 33dbf6c579
1 changed files with 4 additions and 1 deletions

View File

@ -44,7 +44,8 @@ class RhubarbTask(
val message = parseJsonObject(line) val message = parseJsonObject(line)
when (message.string("type")!!) { when (message.string("type")!!) {
"progress" -> { "progress" -> {
reportProgress(message.double("value")!!)} reportProgress(message.double("value")!!)
}
"success" -> { "success" -> {
reportProgress(1.0) reportProgress(1.0)
val resultString = String(Files.readAllBytes(outputFile.filePath), StandardCharsets.UTF_8) val resultString = String(Files.readAllBytes(outputFile.filePath), StandardCharsets.UTF_8)
@ -60,6 +61,8 @@ class RhubarbTask(
throw e throw e
} catch (e: EOFException) { } catch (e: EOFException) {
throw Exception("Rhubarb terminated unexpectedly.") throw Exception("Rhubarb terminated unexpectedly.")
} finally {
process.waitFor();
} }
}} }}