diff --git a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt index 3e45c89d..f8fd0128 100644 --- a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt +++ b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt @@ -293,25 +293,23 @@ internal object PatchCommand : Runnable { } } - // region Patch - - patcher.context.packageMetadata.packageName to patcher.apply { - this += filteredPatches to integrations - - // Execute patches. - runBlocking { - execute().collect { patchResult -> - patchResult.exception?.let { - StringWriter().use { writer -> - it.printStackTrace(PrintWriter(writer)) - logger.severe("\"${patchResult.patch.name}\" failed:\n$writer") - } - } ?: logger.info("\"${patchResult.patch.name}\" succeeded") + patcher += filteredPatches to integrations + + // Execute patches. + runBlocking { + patcher().collect { patchResult -> + val exception = patchResult.exception + ?: return@collect logger.info("\"${patchResult.patch}\" succeeded") + + StringWriter().use { writer -> + exception.printStackTrace(PrintWriter(writer)) + + logger.severe("\"${patchResult.patch}\" failed:\n$writer") } } - }.get() + } - // endregion + patcher.context.packageMetadata.packageName to patcher.get() } // region Save