From 7d9ca8be568dea12d6e6044edfe3be11a8732556 Mon Sep 17 00:00:00 2001 From: Mygod Date: Mon, 26 Dec 2022 22:48:04 -0500 Subject: [PATCH] Fix race condition when cleaning --- .../main/java/be/mygod/vpnhotspot/root/RoutingCommands.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/root/RoutingCommands.kt b/mobile/src/main/java/be/mygod/vpnhotspot/root/RoutingCommands.kt index f43fbad9..185d57b4 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/root/RoutingCommands.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/root/RoutingCommands.kt @@ -2,7 +2,7 @@ package be.mygod.vpnhotspot.root import android.os.Parcelable import be.mygod.librootkotlinx.RootCommand -import be.mygod.librootkotlinx.RootCommandOneWay +import be.mygod.librootkotlinx.RootCommandNoResult import be.mygod.vpnhotspot.net.Routing import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.async @@ -13,7 +13,7 @@ import timber.log.Timber object RoutingCommands { @Parcelize - class Clean : RootCommandOneWay { + class Clean : RootCommandNoResult { @Suppress("BlockingMethodInNonBlockingContext") override suspend fun execute() = withContext(Dispatchers.IO) { val process = ProcessBuilder("sh").fixPath(true).start() @@ -23,6 +23,7 @@ object RoutingCommands { else -> Timber.w("Unexpected exit code $code") } check(process.waitFor() == 0) + null } }