mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-03-12 21:23:02 -07:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user