Skip to content

Commit

Permalink
Fix race condition when cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
Mygod committed Dec 27, 2022
1 parent 7ab4eb0 commit 7d9ca8b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -23,6 +23,7 @@ object RoutingCommands {
else -> Timber.w("Unexpected exit code $code")
}
check(process.waitFor() == 0)
null
}
}

Expand Down

0 comments on commit 7d9ca8b

Please sign in to comment.