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:
parent
3055f73d48
commit
bf2cd9374c
Notes:
sideshowbarker
2024-07-19 04:13:45 +09:00
Author: https://github.com/awesomekling
Commit: bf2cd9374c
4 changed files with 7 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue