mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix positional arguments in shell command on Windows
This commit is contained in:
parent
b48edfd764
commit
c174b01b8f
3 changed files with 29 additions and 12 deletions
10
Cargo.lock
generated
10
Cargo.lock
generated
|
|
@ -325,6 +325,15 @@ dependencies = [
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cmdexpand"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "git+https://github.com/ndtoan96/cmdexpand.git?tag=v0.1.0#be905e223c7ed5f52655fb4096c842f2f587f0d7"
|
||||||
|
dependencies = [
|
||||||
|
"nom",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "color_quant"
|
name = "color_quant"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
|
|
@ -374,6 +383,7 @@ dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-channel",
|
"async-channel",
|
||||||
"clipboard-win",
|
"clipboard-win",
|
||||||
|
"cmdexpand",
|
||||||
"config",
|
"config",
|
||||||
"crossterm",
|
"crossterm",
|
||||||
"futures",
|
"futures",
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ yazi-prebuild = "^0"
|
||||||
|
|
||||||
[target.'cfg(target_os = "windows")'.dependencies]
|
[target.'cfg(target_os = "windows")'.dependencies]
|
||||||
clipboard-win = "^4"
|
clipboard-win = "^4"
|
||||||
|
cmdexpand = {git = "https://github.com/ndtoan96/cmdexpand.git", tag = "v0.1.0"}
|
||||||
|
|
||||||
[target.'cfg(not(target_os = "netbsd"))'.dependencies]
|
[target.'cfg(not(target_os = "netbsd"))'.dependencies]
|
||||||
trash = "^3"
|
trash = "^3"
|
||||||
|
|
|
||||||
30
core/src/external/shell.rs
vendored
30
core/src/external/shell.rs
vendored
|
|
@ -43,16 +43,22 @@ pub fn shell(opt: ShellOpt) -> Result<Child> {
|
||||||
.spawn()?,
|
.spawn()?,
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(target_os = "windows")]
|
||||||
return Ok(
|
{
|
||||||
Command::new("cmd")
|
let args: Vec<String> = opt.args.iter().map(|s| s.to_string_lossy().to_string()).collect();
|
||||||
.stdin(opt.stdio())
|
let cmd = cmdexpand::Expander::new(&opt.cmd.to_string_lossy().to_string())
|
||||||
.stdout(opt.stdio())
|
.disable_context(true)
|
||||||
.stderr(opt.stdio())
|
.add_args(&args)
|
||||||
.arg("/C")
|
.expand()?;
|
||||||
.arg(opt.cmd)
|
Ok(
|
||||||
.args(opt.args)
|
Command::new("cmd")
|
||||||
.kill_on_drop(true)
|
.arg("/C")
|
||||||
.spawn()?,
|
.arg(cmd)
|
||||||
);
|
.stdin(if opt.piped { Stdio::piped() } else { Stdio::inherit() })
|
||||||
|
.stdout(if opt.piped { Stdio::piped() } else { Stdio::inherit() })
|
||||||
|
.stderr(if opt.piped { Stdio::piped() } else { Stdio::inherit() })
|
||||||
|
.kill_on_drop(true)
|
||||||
|
.spawn()?,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue