Merge stack before printing (#9304)

Could you @fdncred try it?

close?: #9264

---------

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
This commit is contained in:
Maxim Zhiburt
2023-05-30 03:03:00 +03:00
committed by GitHub
parent cc04b9a916
commit 7f758d3e51
13 changed files with 84 additions and 34 deletions

View File

@ -281,8 +281,10 @@ pub fn eval_hook(
}
}
engine_state.merge_env(stack)?;
let cwd = get_guaranteed_cwd(engine_state, stack);
engine_state.merge_env(stack, cwd)?;
engine_state.set_current_working_dir(cwd)?;
Ok(output)
}

View File

@ -102,6 +102,12 @@ impl Command for Table {
call: &Call,
input: PipelineData,
) -> Result<PipelineData, ShellError> {
// We merge stack to make sure we render the changes if any were made in the `block`
//
// CONSIDERED TO BE A CODE SMELL AND IT BETTER BE RESOLVED UPWARDS THE CALLING STACK
let engine = engine_state.clone_with_env(stack)?;
let engine_state = &engine;
let start_num: Option<i64> = call.get_flag(engine_state, stack, "start-number")?;
let row_offset = start_num.unwrap_or_default() as usize;
let list: bool = call.has_flag("list");