Use exec whenever possible

This commit is contained in:
Mygod
2018-08-26 19:24:45 +08:00
parent 1c5d7c1109
commit 7a8412407b
3 changed files with 3 additions and 3 deletions

View File

@@ -177,7 +177,7 @@ class RepeaterService : Service(), WifiP2pManager.ChannelListener, SharedPrefere
if (status != Status.IDLE) return START_NOT_STICKY
status = Status.STARTING
val matcher = WifiP2pManagerHelper.patternNetworkInfo.matcher(
loggerSu("dumpsys ${Context.WIFI_P2P_SERVICE}") ?: "")
loggerSu("exec dumpsys ${Context.WIFI_P2P_SERVICE}") ?: "")
when {
!matcher.find() -> startFailure(getString(R.string.root_unavailable))
matcher.group(2) == "true" -> {

View File

@@ -25,7 +25,7 @@ abstract class IpMonitor : Runnable {
thread("${javaClass.simpleName}-input") {
// monitor may get rejected by SELinux
val monitor = ProcessBuilder("sh", "-c",
"ip monitor $monitoredObject || su -c 'ip monitor $monitoredObject'")
"ip monitor $monitoredObject || exec su -c 'exec ip monitor $monitoredObject'")
.redirectErrorStream(true)
.start()
this.monitor = monitor

View File

@@ -37,7 +37,7 @@ class P2pSupplicantConfiguration(private val initContent: String? = null) : Parc
}
override fun describeContents() = 0
private val contentDelegate = lazy { initContent ?: loggerSu("cat /data/misc/wifi/p2p_supplicant.conf") }
private val contentDelegate = lazy { initContent ?: loggerSu("exec cat /data/misc/wifi/p2p_supplicant.conf") }
private val content by contentDelegate
fun readPsk(handler: ((RuntimeException) -> Unit)? = null): String? {