Skip to content

Commit

Permalink
Move push_timer to measure command substitution timing too
Browse files Browse the repository at this point in the history
  • Loading branch information
Accurate0 committed Apr 27, 2024
1 parent 301e4d4 commit 14451ff
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Expand Up @@ -130,6 +130,7 @@ Interactive improvements
- When exporting interactively defined functions (using ``type``, ``functions`` or ``funcsave``) the function body is now indented, same as in the interactive command line editor (:issue:`8603`).
- :kbd:`ctrl-x` (``fish_clipboard_copy``) on multiline commands now includes indentation (:issue:`10437`).
- When using :kbd:`ctrl-x` on Wayland in the VSCode terminal, the clipboard is no longer cleared on :kbd:`ctrl-c`.
- Measuring a command with `time` now considers the time taken for command substitution (:issue:`9100`).

New or improved bindings
^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 0 additions & 2 deletions src/exec.rs
Expand Up @@ -42,7 +42,6 @@ use crate::proc::{
use crate::reader::{reader_run_count, restore_term_mode};
use crate::redirection::{dup2_list_resolve_chain, Dup2List};
use crate::threads::{iothread_perform_cant_wait, is_forked_child};
use crate::timer::push_timer;
use crate::trace::trace_if_enabled_with_args;
use crate::wchar::{wstr, WString, L};
use crate::wchar_ext::ToWString;
Expand Down Expand Up @@ -103,7 +102,6 @@ pub fn exec_job(parser: &Parser, job: &Job, block_io: IoChain) -> bool {
}
return false;
}
let _timer = push_timer(job.wants_timing() && !no_exec());

// Get the deferred process, if any. We will have to remember its pipes.
let mut deferred_pipes = PartialPipes::default();
Expand Down
2 changes: 2 additions & 0 deletions src/parse_execution.rs
Expand Up @@ -1672,6 +1672,8 @@ impl<'a> ParseExecutionContext {
job.internal_job_id,
);

// Start the timer here to ensure command substitution is measured
let _timer = push_timer(job.wants_timing());
// Populate the job. This may fail for reasons like command_not_found. If this fails, an error
// will have been printed.
let pop_result = self.populate_job_from_job_node(ctx, &mut job, job_node, associated_block);
Expand Down

0 comments on commit 14451ff

Please sign in to comment.