mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Also add for Windows
This commit is contained in:
parent
ab0019f8f4
commit
bdcf7941c7
1 changed files with 4 additions and 9 deletions
13
yazi-plugin/src/external/shell.rs
vendored
13
yazi-plugin/src/external/shell.rs
vendored
|
|
@ -29,18 +29,12 @@ impl ShellOpt {
|
|||
}
|
||||
|
||||
pub fn shell(opt: ShellOpt) -> Result<Child> {
|
||||
let level = env::var("YAZI_LEVEL").ok().and_then(|s| s.parse::<u32>().ok()).unwrap_or(0);
|
||||
|
||||
#[cfg(unix)]
|
||||
return Ok(unsafe {
|
||||
Command::new("sh")
|
||||
.env(
|
||||
"YAZI_LEVEL",
|
||||
(env::var("YAZI_LEVEL")
|
||||
.ok()
|
||||
.and_then(|lvl_str| lvl_str.parse::<u32>().ok())
|
||||
.unwrap_or(0)
|
||||
+ 1)
|
||||
.to_string(),
|
||||
)
|
||||
.env("YAZI_LEVEL", (level + 1).to_string())
|
||||
.arg("-c")
|
||||
.stdin(opt.stdio())
|
||||
.stdout(opt.stdio())
|
||||
|
|
@ -65,6 +59,7 @@ pub fn shell(opt: ShellOpt) -> Result<Child> {
|
|||
let expanded = parser::parse(opt.cmd.to_string_lossy().as_ref(), &args_);
|
||||
Ok(
|
||||
Command::new("cmd")
|
||||
.env("YAZI_LEVEL", (level + 1).to_string())
|
||||
.arg("/C")
|
||||
.args(&expanded)
|
||||
.stdin(opt.stdio())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue