From 48e6eaf41d476a05a642a132918e84e2c22e106f Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Tue, 11 Mar 2025 13:29:11 +0800 Subject: [PATCH] fix: more robust process handling for kepubify --- .../gotson/komga/infrastructure/kobo/KepubConverter.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/kobo/KepubConverter.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/kobo/KepubConverter.kt index 5a4722ad2..4f43f3749 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/kobo/KepubConverter.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/kobo/KepubConverter.kt @@ -137,7 +137,14 @@ class KepubConverter( destinationPath.toString(), ) logger.debug { "Starting conversion with: ${command.joinToString(" ")}" } - val process = Runtime.getRuntime().exec(command) + val process = + try { + Runtime.getRuntime().exec(command) + } catch (e: Exception) { + logger.error(e) { "Failed to create process" } + return null + } + if (!process.waitFor(10, TimeUnit.SECONDS)) { logger.error { "Kepub conversion timeout. Command: ${command.joinToString(" ")}" } return null