fix: run blocking IO operations in the correct context

This commit is contained in:
Ax333l 2023-06-11 17:52:43 +02:00
parent ee715b5d22
commit 56bc4ba7f1
No known key found for this signature in database
GPG Key ID: D2B4D85271127D23

View File

@ -8,6 +8,8 @@ import app.revanced.patcher.PatcherOptions
import app.revanced.patcher.data.Context
import app.revanced.patcher.logging.Logger
import app.revanced.patcher.patch.Patch
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import java.io.Closeable
import java.io.File
import java.nio.file.Files
@ -74,7 +76,9 @@ class Session(
logger.info("Patched apk saved to $aligned")
Files.move(aligned.toPath(), output.toPath(), StandardCopyOption.REPLACE_EXISTING)
withContext(Dispatchers.IO) {
Files.move(aligned.toPath(), output.toPath(), StandardCopyOption.REPLACE_EXISTING)
}
}
override fun close() {