1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00

Shell: Make run_command() return a NonnullRefPtrVector<Job>

This never returns null Job pointers.
This commit is contained in:
Andreas Kling 2020-08-06 13:44:30 +02:00
parent 3055f73d48
commit bf2cd9374c
Notes: sideshowbarker 2024-07-19 04:13:45 +09:00
4 changed files with 7 additions and 7 deletions

View file

@ -909,7 +909,7 @@ RefPtr<Value> Execute::run(RefPtr<Shell> shell)
try_read();
};
for (auto job : shell->run_commands(commands)) {
for (auto& job : shell->run_commands(commands)) {
shell->block_on_job(job);
}

View file

@ -734,7 +734,7 @@ int Shell::builtin_time(int argc, const char** argv)
timer.start();
for (auto& job : run_commands(commands)) {
block_on_job(job);
exit_code = job->exit_code();
exit_code = job.exit_code();
}
fprintf(stderr, "Time: %d ms\n", timer.elapsed());
return exit_code;

View file

@ -588,9 +588,9 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
return *job;
}
Vector<RefPtr<Job>> Shell::run_commands(Vector<AST::Command>& commands)
NonnullRefPtrVector<Job> Shell::run_commands(Vector<AST::Command>& commands)
{
Vector<RefPtr<Job>> jobs_to_wait_for;
NonnullRefPtrVector<Job> jobs_to_wait_for;
for (auto& command : commands) {
#ifdef SH_DEBUG
@ -618,10 +618,10 @@ Vector<RefPtr<Job>> Shell::run_commands(Vector<AST::Command>& commands)
if (command.should_wait) {
block_on_job(job);
if (!job->is_suspended())
jobs_to_wait_for.append(job);
jobs_to_wait_for.append(*job);
} else {
if (command.is_pipe_source) {
jobs_to_wait_for.append(job);
jobs_to_wait_for.append(*job);
} else if (command.should_notify_if_in_background) {
job->set_running_in_background(true);
restore_ios();

View file

@ -76,7 +76,7 @@ public:
int run_command(const StringView&);
bool is_runnable(const StringView&);
RefPtr<Job> run_command(const AST::Command&);
Vector<RefPtr<Job>> run_commands(Vector<AST::Command>&);
NonnullRefPtrVector<Job> run_commands(Vector<AST::Command>&);
bool run_file(const String&, bool explicitly_invoked = true);
bool run_builtin(int argc, const char** argv, int& retval);
bool has_builtin(const StringView&) const;