Revert "webui: support mount master mode"
This reverts commit 922703d2ff.
This commit is contained in:
@@ -16,7 +16,6 @@ Spawns a **root** shell and runs a command within that shell, passing the `stdou
|
|||||||
- `options` `<Object>`
|
- `options` `<Object>`
|
||||||
- `cwd` - Current working directory of the child process
|
- `cwd` - Current working directory of the child process
|
||||||
- `env` - Environment key-value pairs
|
- `env` - Environment key-value pairs
|
||||||
- `mm` `boolean` - Mount master mode, true to enter global mount namespace
|
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { exec } from 'kernelsu';
|
import { exec } from 'kernelsu';
|
||||||
@@ -39,7 +38,6 @@ Returns a `ChildProcess`, Instances of the ChildProcess represent spawned child
|
|||||||
- `options` `<Object>`:
|
- `options` `<Object>`:
|
||||||
- `cwd` `<string>` - Current working directory of the child process
|
- `cwd` `<string>` - Current working directory of the child process
|
||||||
- `env` `<Object>` - Environment key-value pairs
|
- `env` `<Object>` - Environment key-value pairs
|
||||||
- `mm` `boolean` - Mount master mode, true to enter global mount namespace
|
|
||||||
|
|
||||||
Example of running `ls -lh /data`, capturing `stdout`, `stderr`, and the exit code:
|
Example of running `ls -lh /data`, capturing `stdout`, `stderr`, and the exit code:
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class WebViewInterface(val context: Context, private val webView: WebView) {
|
|||||||
exec(cmd, null, callbackFunc)
|
exec(cmd, null, callbackFunc)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun processOptions(sb: StringBuilder, options: String?): JSONObject {
|
private fun processOptions(sb: StringBuilder, options: String?) {
|
||||||
val opts = if (options == null) JSONObject() else {
|
val opts = if (options == null) JSONObject() else {
|
||||||
JSONObject(options)
|
JSONObject(options)
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,6 @@ class WebViewInterface(val context: Context, private val webView: WebView) {
|
|||||||
sb.append("export ${key}=${env.getString(key)};")
|
sb.append("export ${key}=${env.getString(key)};")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return opts
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
@@ -61,11 +60,10 @@ class WebViewInterface(val context: Context, private val webView: WebView) {
|
|||||||
callbackFunc: String
|
callbackFunc: String
|
||||||
) {
|
) {
|
||||||
val finalCommand = StringBuilder()
|
val finalCommand = StringBuilder()
|
||||||
val opts = processOptions(finalCommand, options)
|
processOptions(finalCommand, options)
|
||||||
finalCommand.append(cmd)
|
finalCommand.append(cmd)
|
||||||
|
|
||||||
val mountMaster = opts.optBoolean("mm", false)
|
val shell = createRootShell()
|
||||||
val shell = createRootShell(mountMaster)
|
|
||||||
val result = shell.newJob().add(finalCommand.toString()).to(ArrayList(), ArrayList()).exec()
|
val result = shell.newJob().add(finalCommand.toString()).to(ArrayList(), ArrayList()).exec()
|
||||||
val stdout = result.out.joinToString(separator = "\n")
|
val stdout = result.out.joinToString(separator = "\n")
|
||||||
val stderr = result.err.joinToString(separator = "\n")
|
val stderr = result.err.joinToString(separator = "\n")
|
||||||
@@ -85,7 +83,7 @@ class WebViewInterface(val context: Context, private val webView: WebView) {
|
|||||||
fun spawn(command: String, args: String, options: String?, callbackFunc: String) {
|
fun spawn(command: String, args: String, options: String?, callbackFunc: String) {
|
||||||
val finalCommand = StringBuilder()
|
val finalCommand = StringBuilder()
|
||||||
|
|
||||||
val opts = processOptions(finalCommand, options)
|
processOptions(finalCommand, options)
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(args)) {
|
if (!TextUtils.isEmpty(args)) {
|
||||||
finalCommand.append(command).append(" ")
|
finalCommand.append(command).append(" ")
|
||||||
@@ -99,8 +97,7 @@ class WebViewInterface(val context: Context, private val webView: WebView) {
|
|||||||
finalCommand.append(command)
|
finalCommand.append(command)
|
||||||
}
|
}
|
||||||
|
|
||||||
val mountMaster = opts.optBoolean("mm", false)
|
val shell = createRootShell()
|
||||||
val shell = createRootShell(mountMaster)
|
|
||||||
|
|
||||||
val emitData = fun(name: String, data: String) {
|
val emitData = fun(name: String, data: String) {
|
||||||
val jsCode =
|
val jsCode =
|
||||||
|
|||||||
Reference in New Issue
Block a user