Revert "Use SHELL environment"

This reverts commit 293140f64e.
This commit is contained in:
Mygod
2020-07-10 04:45:55 +08:00
parent 14beddd0dd
commit 6e571eccaf
3 changed files with 3 additions and 5 deletions

View File

@@ -19,14 +19,12 @@ import java.io.FileOutputStream
import java.io.InterruptedIOException
import java.util.concurrent.Executor
val SHELL = System.getenv("SHELL") ?: "sh"
@Parcelize
class Dump(val path: String, val cacheDir: File = app.deviceStorage.codeCacheDir) : RootCommandNoResult {
@Suppress("BlockingMethodInNonBlockingContext")
override suspend fun execute() = withContext(Dispatchers.IO) {
FileOutputStream(path, true).use { out ->
val process = ProcessBuilder(SHELL).redirectErrorStream(true).start()
val process = ProcessBuilder("sh").redirectErrorStream(true).start()
process.outputStream.bufferedWriter().use { commands ->
// https://android.googlesource.com/platform/external/iptables/+/android-7.0.0_r1/iptables/Android.mk#34
val iptablesSave = if (Build.VERSION.SDK_INT < 24) File(cacheDir, "iptables-save").absolutePath.also {