mirror of
https://github.com/tiann/KernelSU.git
synced 2025-02-20 11:43:32 +08:00
api: spawn CallbackList use UiThreadHandler::runAndWait executor (#2096)
 Because the exit callback in js cleans up the ChildProcess, when the last callback of stdout is executed after the exit callback, an error like “emitData ReferenceError: spawn_callback_1727358276092_68 is not defined” will occur.
This commit is contained in:
parent
ac20b76eaf
commit
f65aaff4e3
@ -14,6 +14,7 @@ import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
import com.topjohnwu.superuser.CallbackList
|
||||
import com.topjohnwu.superuser.ShellUtils
|
||||
import com.topjohnwu.superuser.internal.UiThreadHandler
|
||||
import me.weishu.kernelsu.ui.util.listModules
|
||||
import me.weishu.kernelsu.ui.util.createRootShell
|
||||
import me.weishu.kernelsu.ui.util.withNewRootShell
|
||||
@ -110,13 +111,13 @@ class WebViewInterface(val context: Context, private val webView: WebView, priva
|
||||
}
|
||||
}
|
||||
|
||||
val stdout = object : CallbackList<String>() {
|
||||
val stdout = object : CallbackList<String>(UiThreadHandler::runAndWait) {
|
||||
override fun onAddElement(s: String) {
|
||||
emitData("stdout", s)
|
||||
}
|
||||
}
|
||||
|
||||
val stderr = object : CallbackList<String>() {
|
||||
val stderr = object : CallbackList<String>(UiThreadHandler::runAndWait) {
|
||||
override fun onAddElement(s: String) {
|
||||
emitData("stderr", s)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user