summaryrefslogtreecommitdiff
path: root/Shell
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-06-19 16:32:19 +0430
committerAndreas Kling <kling@serenityos.org>2020-07-05 15:43:14 +0200
commit16def040af4c9cf60170f741f417a422fbafafd2 (patch)
treeef5b797d49a7d0f615004b610eee64e401d95127 /Shell
parentbc3285abb02c13918cf2653deb39dd9c9d71c202 (diff)
downloadserenity-16def040af4c9cf60170f741f417a422fbafafd2.zip
Shell: Do not try to recreate a command from a list of args in time
Shell already provides a run_command(AST::Command) which can be constructed from a list of arguments, use that instead.
Diffstat (limited to 'Shell')
-rw-r--r--Shell/Builtin.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/Shell/Builtin.cpp b/Shell/Builtin.cpp
index 4be6e4ff4f..5a3928fde9 100644
--- a/Shell/Builtin.cpp
+++ b/Shell/Builtin.cpp
@@ -654,15 +654,18 @@ int Shell::builtin_time(int argc, const char** argv)
if (!parser.parse(argc, const_cast<char**>(argv), false))
return 1;
- StringBuilder builder;
- builder.join(' ', args);
+ AST::Command command;
+ for (auto& arg : args)
+ command.argv.append(arg);
Core::ElapsedTimer timer;
timer.start();
- // TODO: Exit code
- run_command(builder.string_view());
+ auto job = run_command(command);
+ if (!job)
+ return 1;
+ block_on_job(job);
fprintf(stderr, "Time: %d ms\n", timer.elapsed());
- return 0;
+ return job->exit_code();
}
int Shell::builtin_umask(int argc, const char** argv)