Shell: Restore the terminal PGID before printing out job status on exit
This fixes the assert tripping when interrupting a foreground job. Also make `bg` mark the job as 'should announce exit'.
This commit is contained in:
parent
350b2c6d9e
commit
a2879f53c8
Notes:
sideshowbarker
2024-07-19 00:56:18 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/a2879f53c80 Pull-request: https://github.com/SerenityOS/serenity/pull/4378 Reviewed-by: https://github.com/ccapitalK ✅
2 changed files with 3 additions and 0 deletions
|
@ -98,6 +98,7 @@ int Shell::builtin_bg(int argc, const char** argv)
|
|||
}
|
||||
|
||||
job->set_running_in_background(true);
|
||||
job->set_should_announce_exit(true);
|
||||
job->set_is_suspended(false);
|
||||
|
||||
dbgln("Resuming {} ({})", job->pid(), job->cmd());
|
||||
|
|
|
@ -871,6 +871,8 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
|
|||
job->on_exit = [this](auto job) {
|
||||
if (!job->exited())
|
||||
return;
|
||||
|
||||
restore_ios();
|
||||
if (job->is_running_in_background() && job->should_announce_exit())
|
||||
warnln("Shell: Job {} ({}) exited\n", job->job_id(), job->cmd().characters());
|
||||
else if (job->signaled() && job->should_announce_signal())
|
||||
|
|
Loading…
Add table
Reference in a new issue