Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Jun 18, 2024
1 parent 948757d commit 88edb9c
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions src/main/kotlin/app/revanced/cli/command/PatchCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 88edb9c

Please sign in to comment.