Refine clean up procedure

This commit is contained in:
Mygod
2018-01-04 16:08:09 +08:00
parent 3cfbb82a39
commit 4b5efdd310
2 changed files with 2 additions and 2 deletions

View File

@@ -31,7 +31,7 @@ class SettingsFragment : PreferenceFragmentCompatDividers(), ServiceConnection {
"while iptables -D FORWARD -j vpnhotspot_fwd; do done", "while iptables -D FORWARD -j vpnhotspot_fwd; do done",
"iptables -F vpnhotspot_fwd", "iptables -F vpnhotspot_fwd",
"iptables -X vpnhotspot_fwd", "iptables -X vpnhotspot_fwd",
"ip rule del lookup 62", "while ip rule del lookup 62; do done",
"ip route flush table 62") "ip route flush table 62")
true true
} }

View File

@@ -26,7 +26,7 @@ const val NOISYSU_TAG = "NoisySU"
const val NOISYSU_SUFFIX = "SUCCESS\n" const val NOISYSU_SUFFIX = "SUCCESS\n"
fun noisySu(vararg commands: String): Boolean { fun noisySu(vararg commands: String): Boolean {
val process = ProcessBuilder("su", "-c", """function noisy() { "$@" || echo "$@" exited with $?; } val process = ProcessBuilder("su", "-c", """function noisy() { "$@" || echo "$@" exited with $?; }
${commands.joinToString("\n") { "noisy $it" }} ${commands.joinToString("\n") { if (it.startsWith("while ")) it else "noisy $it" }}
echo $NOISYSU_SUFFIX""") echo $NOISYSU_SUFFIX""")
.redirectErrorStream(true) .redirectErrorStream(true)
.start() .start()