mirror of
https://github.com/nushell/nushell
synced 2025-01-26 03:45:19 +00:00
Revert "fix: make exec command decrement SHLVL correctly" (#14580)
Reverts nushell/nushell#14570
This commit is contained in:
parent
cc0616b753
commit
05ee7ea9c7
2 changed files with 1 additions and 11 deletions
|
@ -61,16 +61,6 @@ On Windows based systems, Nushell will wait for the command to finish and then e
|
||||||
let envs = env_to_strings(engine_state, stack)?;
|
let envs = env_to_strings(engine_state, stack)?;
|
||||||
command.env_clear();
|
command.env_clear();
|
||||||
command.envs(envs);
|
command.envs(envs);
|
||||||
// Decrement SHLVL as removing the current shell from the stack
|
|
||||||
// (only works in interactive mode, same as initialization)
|
|
||||||
if engine_state.is_interactive {
|
|
||||||
if let Some(shlvl) = engine_state.get_env_var("SHLVL") {
|
|
||||||
let shlvl = shlvl.as_int().unwrap_or(1) - 1;
|
|
||||||
command.env("SHLVL", shlvl.to_string());
|
|
||||||
} else {
|
|
||||||
command.env("SHLVL", "0");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configure args.
|
// Configure args.
|
||||||
let args = crate::eval_arguments_from_call(engine_state, stack, call)?;
|
let args = crate::eval_arguments_from_call(engine_state, stack, call)?;
|
||||||
|
|
|
@ -325,7 +325,7 @@ fn main() -> Result<()> {
|
||||||
if engine_state.is_interactive {
|
if engine_state.is_interactive {
|
||||||
let mut shlvl = engine_state
|
let mut shlvl = engine_state
|
||||||
.get_env_var("SHLVL")
|
.get_env_var("SHLVL")
|
||||||
.map(|x| x.as_int().unwrap_or(0))
|
.map(|x| x.as_str().unwrap_or("0").parse::<i64>().unwrap_or(0))
|
||||||
.unwrap_or(0);
|
.unwrap_or(0);
|
||||||
shlvl += 1;
|
shlvl += 1;
|
||||||
engine_state.add_env_var("SHLVL".to_string(), Value::int(shlvl, Span::unknown()));
|
engine_state.add_env_var("SHLVL".to_string(), Value::int(shlvl, Span::unknown()));
|
||||||
|
|
Loading…
Reference in a new issue