fix: more robust process handling for kepubify

This commit is contained in:
Gauthier Roebroeck 2025-03-11 13:29:11 +08:00
parent 62d193db38
commit 48e6eaf41d

View file

@ -137,7 +137,14 @@ class KepubConverter(
destinationPath.toString(), destinationPath.toString(),
) )
logger.debug { "Starting conversion with: ${command.joinToString(" ")}" } 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)) { if (!process.waitFor(10, TimeUnit.SECONDS)) {
logger.error { "Kepub conversion timeout. Command: ${command.joinToString(" ")}" } logger.error { "Kepub conversion timeout. Command: ${command.joinToString(" ")}" }
return null return null