Skip to content

Petition to keep Shizuku.newProcess #276

Description

@RohitKushvaha01
private fun runShellCommandWithShizuku(command: Array<String>): Pair<String, String> {
    return try {
        val clazz = Class.forName("rikka.shizuku.Shizuku")
        val method = clazz.getDeclaredMethod("newProcess", Array<String>::class.java, Array<String>::class.java, String::class.java)
        method.isAccessible = true

        val remoteProcess = method.invoke(null, command, null, null) as rikka.shizuku.ShizukuRemoteProcess
        val output = remoteProcess.inputStream.bufferedReader().use { it.readText() }
        val error = remoteProcess.errorStream.bufferedReader().use { it.readText() }

        remoteProcess.destroy()
        Pair(output.trim(), error.trim())
    } catch (exception: Exception) {
        Pair("", "Exception: ${exception.message}")
    }
}

Please do not remove or deprecate this API. I use it solely to execute shell commands via Shizuku and do not require the UserProcess features of the Shizuku API. A straightforward way to run commands as the shell user is essential for my use case, so I kindly request that this functionality remains available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions