Try both p2p_supplicant.conf paths for Project Treble
This commit is contained in:
@@ -57,8 +57,8 @@ class RootSession : AutoCloseable {
|
||||
}
|
||||
|
||||
class UnexpectedOutputException(msg: String) : RuntimeException(msg)
|
||||
private fun checkOutput(command: String, result: Shell.Result, out: Boolean = result.out.isNotEmpty(),
|
||||
err: Boolean = result.err.isNotEmpty()): String {
|
||||
fun checkOutput(command: String, result: Shell.Result, out: Boolean = result.out.isNotEmpty(),
|
||||
err: Boolean = result.err.isNotEmpty()): String {
|
||||
val msg = StringBuilder("$command exited with ${result.code}")
|
||||
if (out) result.out.forEach { msg.append("\n$it") }
|
||||
if (err) result.err.forEach { msg.append("\nE $it") }
|
||||
@@ -101,22 +101,11 @@ class RootSession : AutoCloseable {
|
||||
}).exec()
|
||||
}
|
||||
fun exec(command: String) = checkOutput(command, execQuiet(command))
|
||||
fun execWithWait(command: String) {
|
||||
val result = execQuiet(command)
|
||||
val message = checkOutput(command, result, err = false)
|
||||
if (result.err.isNotEmpty()) Timber.i(message)
|
||||
}
|
||||
fun execOutUnjoined(command: String): List<String> {
|
||||
val result = execQuiet(command)
|
||||
checkOutput(command, result, false)
|
||||
return result.out
|
||||
}
|
||||
fun execOutUnjoinedWithWait(command: String): List<String> {
|
||||
val result = execQuiet(command)
|
||||
val message = checkOutput(command, result, false, false)
|
||||
if (result.err.isNotEmpty()) Timber.i(message)
|
||||
return result.out
|
||||
}
|
||||
fun execOut(command: String): String = execOutUnjoined(command).joinToString("\n")
|
||||
|
||||
/**
|
||||
@@ -127,7 +116,11 @@ class RootSession : AutoCloseable {
|
||||
|
||||
fun exec(command: String, revert: String? = null, wait: Boolean = false) {
|
||||
if (revert != null) revertCommands.addFirst(revert) // add first just in case exec fails
|
||||
if (wait) this@RootSession.execWithWait(command) else this@RootSession.exec(command)
|
||||
if (wait) {
|
||||
val result = this@RootSession.execQuiet(command)
|
||||
val message = checkOutput(command, result, err = false)
|
||||
if (result.err.isNotEmpty()) Timber.i(message)
|
||||
} else this@RootSession.exec(command)
|
||||
}
|
||||
fun execQuiet(command: String) = this@RootSession.execQuiet(command)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user