Skip to content

Commit 8720096

Browse files
committed
Upload file
1 parent eb68550 commit 8720096

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

common/src/main/java/com/omarea/common/shell/ShellExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

pio/src/main/java/com/projectkr/shell/SplashActivity.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)