mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 12:25:58 +02:00
Increment SHLVL before run_repl() (#14732)
# Description A follow-on to #14727: * Instead of using `is-interactive` as the trigger for incrementing `SHLVL`, this change puts the increment logic just before `run_repl()` is called. * Tests are changed to use `-e` * Moves the `confirm_stdin_is_terminal()` call immediately **after** the `prerun_cmd` (which executes `--execute (-e) <commandstring>`. The fact that it was **before** that call seems to be a bug, since the error message says *"or provide arguments to invoke a script"* even if `--execute` was used. This change enables REPL testing using `--execute (-e)`. * Added a test to ensure `-c` does *not* increment SHLVL. # User-Facing Changes `$env.SHLVL` runs before the REPL is started, rather than when `is-interactive` # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting N/A
This commit is contained in:
@ -63,8 +63,6 @@ pub fn evaluate_repl(
|
||||
let config = engine_state.get_config();
|
||||
let use_color = config.use_ansi_coloring.get(engine_state);
|
||||
|
||||
confirm_stdin_is_terminal()?;
|
||||
|
||||
let mut entry_num = 0;
|
||||
|
||||
// Let's grab the shell_integration configs
|
||||
@ -104,6 +102,8 @@ pub fn evaluate_repl(
|
||||
engine_state.merge_env(&mut unique_stack)?;
|
||||
}
|
||||
|
||||
confirm_stdin_is_terminal()?;
|
||||
|
||||
let hostname = System::host_name();
|
||||
if shell_integration_osc2 {
|
||||
run_shell_integration_osc2(None, engine_state, &mut unique_stack, use_color);
|
||||
|
Reference in New Issue
Block a user