We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 883b3a1 commit fe72bb3Copy full SHA for fe72bb3
crates/nu-protocol/src/engine/engine_state.rs
@@ -376,13 +376,14 @@ impl EngineState {
376
pub fn cleanup_stack_variables(&self, stack: &mut Stack) {
377
use std::collections::HashSet;
378
379
- // Collect all VarIds that are still referenced by overlays using functional style
+ // Collect all VarIds that are still referenced by overlays
380
let referenced_vars: HashSet<_> = self
381
.scope
382
.overlays
383
.iter()
384
.flat_map(|(_, overlay)| overlay.vars.values())
385
.copied()
386
+ // Always preserve critical system variables
387
.chain([NU_VARIABLE_ID, IN_VARIABLE_ID, ENV_VARIABLE_ID])
388
.collect();
389
0 commit comments