File tree Expand file tree Collapse file tree
common/src/main/java/com/omarea/common/shell
pio/src/main/java/com/projectkr/shell Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,6 +75,6 @@ public static Process getSuperUserRuntime() throws IOException {
7575 }
7676
7777 public static Process getRuntime () throws IOException {
78- return getProcess ("sh" );
78+ return getProcess ("/system/bin/ sh" );
7979 }
8080}
Original file line number Diff line number Diff line change @@ -196,10 +196,12 @@ class SplashActivity : AppCompatActivity() {
196196 }
197197
198198 private fun runBeforeStartSh (config : KrScriptConfig , hasRoot : Boolean ) {
199- // Coroutine IO
200199 lifecycleScope.launch(Dispatchers .IO ) {
201200 try {
202- val process = if (hasRoot) ShellExecutor .getSuperUserRuntime() else ShellExecutor .getRuntime()
201+ val process = if (hasRoot)
202+ ShellExecutor .getSuperUserRuntime()
203+ else
204+ ShellExecutor .getRuntime()
203205 process?.let {
204206 DataOutputStream (it.outputStream).use { os ->
205207 ScriptEnvironmen .executeShell(
@@ -211,15 +213,17 @@ class SplashActivity : AppCompatActivity() {
211213 " pio-splash"
212214 )
213215 }
214-
215- // Đọc stdout và stderr bằng coroutine con
216216 launch { readStreamAsync(it.inputStream.bufferedReader()) }
217217 launch { readStreamAsync(it.errorStream.bufferedReader()) }
218218
219219 it.waitFor()
220220 }
221+ } catch (e: Exception ) {
222+ e.printStackTrace()
221223 } finally {
222- withContext(Dispatchers .Main ) { gotoHome() }
224+ withContext(Dispatchers .Main ) {
225+ gotoHome()
226+ }
223227 }
224228 }
225229 }
You can’t perform that action at this time.
0 commit comments