Fix module install showing script help due to unescaped single quotes

The command passed to busybox `script -c '...'` contained embedded
single quotes (from echo and file path), breaking the outer quoting.
Escape them with the standard POSIX `'\''` technique before wrapping.

Made-with: Cursor
This commit is contained in:
LoveSy
2026-03-09 10:11:21 +08:00
parent 93c6381b1d
commit ebfadcc457

View File

@@ -35,10 +35,11 @@ fun runSuCommand(emulator: TerminalEmulator, command: String): Boolean {
val cols = emulator.mColumns
val rows = emulator.mRows
val wrappedCmd = "export TERM=xterm-256color; stty cols $cols rows $rows 2>/dev/null; $command"
val escapedCmd = wrappedCmd.replace("'", "'\\''")
val process = ProcessBuilder(
"su", "-c",
"$busyboxPath script -q -c '$wrappedCmd' /dev/null"
"$busyboxPath script -q -c '$escapedCmd' /dev/null"
).redirectErrorStream(true).start()
process.outputStream.close()