From 33dbf6c579ee10768cf1251db2b7dc32fc2d1916 Mon Sep 17 00:00:00 2001 From: Daniel Wolf Date: Sun, 18 Feb 2018 20:51:50 +0100 Subject: [PATCH] Fixed race condition when deleting temporary files --- .../com/rhubarb_lip_sync/rhubarb_for_spine/RhubarbTask.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extras/rhubarb-for-spine/src/main/kotlin/com/rhubarb_lip_sync/rhubarb_for_spine/RhubarbTask.kt b/extras/rhubarb-for-spine/src/main/kotlin/com/rhubarb_lip_sync/rhubarb_for_spine/RhubarbTask.kt index 34a5505..8c23dbc 100644 --- a/extras/rhubarb-for-spine/src/main/kotlin/com/rhubarb_lip_sync/rhubarb_for_spine/RhubarbTask.kt +++ b/extras/rhubarb-for-spine/src/main/kotlin/com/rhubarb_lip_sync/rhubarb_for_spine/RhubarbTask.kt @@ -44,7 +44,8 @@ class RhubarbTask( val message = parseJsonObject(line) when (message.string("type")!!) { "progress" -> { - reportProgress(message.double("value")!!)} + reportProgress(message.double("value")!!) + } "success" -> { reportProgress(1.0) val resultString = String(Files.readAllBytes(outputFile.filePath), StandardCharsets.UTF_8) @@ -60,6 +61,8 @@ class RhubarbTask( throw e } catch (e: EOFException) { throw Exception("Rhubarb terminated unexpectedly.") + } finally { + process.waitFor(); } }}