ksud: fix su args parse error. close #736
This commit is contained in:
@@ -46,4 +46,4 @@ android_logger = "0.13"
|
||||
[profile.release]
|
||||
strip = true
|
||||
opt-level = "z"
|
||||
lto = true
|
||||
# lto = true
|
||||
|
||||
@@ -161,22 +161,14 @@ pub fn root_shell() -> Result<()> {
|
||||
let preserve_env = matches.opt_present("p");
|
||||
let mount_master = matches.opt_present("M");
|
||||
|
||||
// we've make sure that -c is the last option and it already contains the whole command, no need to construct it again
|
||||
let args = matches
|
||||
.opt_str("c")
|
||||
.map(|cmd| vec!["-c".to_string(), cmd])
|
||||
.unwrap_or_default();
|
||||
|
||||
let mut free_idx = 0;
|
||||
let command = matches.opt_str("c").map(|cmd| {
|
||||
free_idx = matches.free.len();
|
||||
let mut cmds = vec![];
|
||||
cmds.push(cmd);
|
||||
cmds.extend(matches.free.clone());
|
||||
cmds
|
||||
});
|
||||
|
||||
let mut args = vec![];
|
||||
if let Some(cmd) = command {
|
||||
args.push("-c".to_string());
|
||||
args.push(cmd.join(" "));
|
||||
};
|
||||
|
||||
if free_idx < matches.free.len() && matches.free[free_idx] == "-" {
|
||||
if !matches.free.is_empty() && matches.free[free_idx] == "-" {
|
||||
is_login = true;
|
||||
free_idx += 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user