Skip to content

Commit

Permalink
move a stack environment variable assignment back up
Browse files Browse the repository at this point in the history
  • Loading branch information
rtpg committed Jan 28, 2024
1 parent 0db4ee9 commit 67f0779
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions crates/nu-cli/src/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,13 +666,16 @@ pub fn evaluate_repl(
false,
);
}
// we save the duration here, but will actually modify
// the stack later

let cmd_duration = start_time.elapsed();
stack.add_env_var(
"CMD_DURATION_MS".into(),
Value::string(format!("{}", cmd_duration.as_millis()), Span::unknown()),
);

if history_supports_meta && !s.is_empty() && line_editor.has_last_command_context()
{
// not a stack reference because update_last_commandcontext gets called immediately
// not a long-held stack reference because update_last_command_context gets called immediately
let stack = stack.child_stack();
line_editor
.update_last_command_context(&|mut c| {
Expand Down Expand Up @@ -746,10 +749,6 @@ pub fn evaluate_repl(
repl.buffer = "".to_string();
repl.cursor_pos = 0;
drop(repl);
stack.add_env_var(
"CMD_DURATION_MS".into(),
Value::string(format!("{}", cmd_duration.as_millis()), Span::unknown()),
);
}
Ok(Signal::CtrlC) => {
// `Reedline` clears the line content. New prompt is shown
Expand Down

0 comments on commit 67f0779

Please sign in to comment.