From 7170df7dd862646e9b730e3994216920e3d3f83e Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Mon, 13 Jul 2020 09:31:28 +0430 Subject: [PATCH] Shell: Resolve aliases in builtin_time --- Shell/Builtin.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Shell/Builtin.cpp b/Shell/Builtin.cpp index 8072fd3560..a2e77c4183 100644 --- a/Shell/Builtin.cpp +++ b/Shell/Builtin.cpp @@ -698,14 +698,17 @@ int Shell::builtin_time(int argc, const char** argv) for (auto& arg : args) command.argv.append(arg); + auto commands = expand_aliases({ move(command) }); + Core::ElapsedTimer timer; + int exit_code = 1; timer.start(); - auto job = run_command(command); - if (!job) - return 1; - block_on_job(job); + for (auto& job : run_commands(commands)) { + block_on_job(job); + exit_code = job->exit_code(); + } fprintf(stderr, "Time: %d ms\n", timer.elapsed()); - return job->exit_code(); + return exit_code; } int Shell::builtin_umask(int argc, const char** argv)