File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 1
- use std:: { ffi:: OsString , process:: Stdio } ;
1
+ use std:: { env , ffi:: OsString , process:: Stdio } ;
2
2
3
3
use anyhow:: Result ;
4
4
use tokio:: process:: { Child , Command } ;
@@ -29,9 +29,12 @@ impl ShellOpt {
29
29
}
30
30
31
31
pub fn shell ( opt : ShellOpt ) -> Result < Child > {
32
+ let level = env:: var ( "YAZI_LEVEL" ) . ok ( ) . and_then ( |s| s. parse :: < u32 > ( ) . ok ( ) ) . unwrap_or ( 0 ) ;
33
+
32
34
#[ cfg( unix) ]
33
35
return Ok ( unsafe {
34
36
Command :: new ( "sh" )
37
+ . env ( "YAZI_LEVEL" , ( level + 1 ) . to_string ( ) )
35
38
. arg ( "-c" )
36
39
. stdin ( opt. stdio ( ) )
37
40
. stdout ( opt. stdio ( ) )
@@ -56,6 +59,7 @@ pub fn shell(opt: ShellOpt) -> Result<Child> {
56
59
let expanded = parser:: parse ( opt. cmd . to_string_lossy ( ) . as_ref ( ) , & args_) ;
57
60
Ok (
58
61
Command :: new ( "cmd" )
62
+ . env ( "YAZI_LEVEL" , ( level + 1 ) . to_string ( ) )
59
63
. arg ( "/C" )
60
64
. args ( & expanded)
61
65
. stdin ( opt. stdio ( ) )
You can’t perform that action at this time.
0 commit comments