mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat: add YAZI_LEVEL env variable for shells
This commit is contained in:
parent
ee8b8fc730
commit
8c4f9308c6
1 changed files with 10 additions and 1 deletions
11
yazi-plugin/src/external/shell.rs
vendored
11
yazi-plugin/src/external/shell.rs
vendored
|
|
@ -1,4 +1,4 @@
|
|||
use std::{ffi::OsString, process::Stdio};
|
||||
use std::{env, ffi::OsString, process::Stdio};
|
||||
|
||||
use anyhow::Result;
|
||||
use tokio::process::{Child, Command};
|
||||
|
|
@ -32,6 +32,15 @@ pub fn shell(opt: ShellOpt) -> Result<Child> {
|
|||
#[cfg(unix)]
|
||||
return Ok(unsafe {
|
||||
Command::new("sh")
|
||||
.env(
|
||||
"YAZI_LEVEL",
|
||||
(env::var("YAZI_LEVEL")
|
||||
.ok()
|
||||
.and_then(|lvl_str| lvl_str.parse::<i32>().ok())
|
||||
.unwrap_or(0)
|
||||
+ 1)
|
||||
.to_string(),
|
||||
)
|
||||
.arg("-c")
|
||||
.stdin(opt.stdio())
|
||||
.stdout(opt.stdio())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue