mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:08:11 +00:00
Shell: Announce job events at the right times
This fixes a duplicate message when running `jobs` for the first time after a job has been moved to the background. Also actually announces background exits now :^)
This commit is contained in:
parent
715e11f692
commit
7b5ead64a5
2 changed files with 3 additions and 8 deletions
|
@ -73,7 +73,7 @@ static inline Vector<Command> join_commands(Vector<Command> left, Vector<Command
|
||||||
|
|
||||||
command.should_wait = first_in_right.should_wait && last_in_left.should_wait;
|
command.should_wait = first_in_right.should_wait && last_in_left.should_wait;
|
||||||
command.is_pipe_source = first_in_right.is_pipe_source;
|
command.is_pipe_source = first_in_right.is_pipe_source;
|
||||||
command.should_notify_if_in_background = first_in_right.should_wait && last_in_left.should_notify_if_in_background;
|
command.should_notify_if_in_background = first_in_right.should_notify_if_in_background || last_in_left.should_notify_if_in_background;
|
||||||
|
|
||||||
Vector<Command> commands;
|
Vector<Command> commands;
|
||||||
commands.append(left);
|
commands.append(left);
|
||||||
|
|
|
@ -699,11 +699,9 @@ NonnullRefPtrVector<Job> Shell::run_commands(Vector<AST::Command>& commands)
|
||||||
if (command.should_wait) {
|
if (command.should_wait) {
|
||||||
block_on_job(job);
|
block_on_job(job);
|
||||||
} else {
|
} else {
|
||||||
if (command.is_pipe_source) {
|
job->set_running_in_background(true);
|
||||||
job->set_running_in_background(true);
|
if (!command.is_pipe_source && command.should_notify_if_in_background)
|
||||||
} else if (command.should_notify_if_in_background) {
|
|
||||||
job->set_should_announce_exit(true);
|
job->set_should_announce_exit(true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,9 +757,6 @@ void Shell::block_on_job(RefPtr<Job> job)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
loop.exec();
|
loop.exec();
|
||||||
|
|
||||||
if (job->is_suspended())
|
|
||||||
job->print_status(Job::PrintStatusMode::Basic);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String Shell::get_history_path()
|
String Shell::get_history_path()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue