1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:37:36 +00:00

Shell: Handle SIGCHLD after sending SIGCONT to job

This fixes `fg` and `bg` causing the shell to go into an infinite loop
of trying to `waitpid` until some current job changes state.

a.k.a. "Fix Shell backgrounding, yet again!" :P
This commit is contained in:
AnotherTest 2021-03-30 02:19:02 +04:30 committed by Andreas Kling
parent 50f5959996
commit 5d19509616
3 changed files with 12 additions and 3 deletions

View file

@ -86,6 +86,7 @@ public:
bool should_announce_exit() const { return m_should_announce_exit; }
bool should_announce_signal() const { return m_should_announce_signal; }
bool is_suspended() const { return m_is_suspended; }
bool shell_did_continue() const { return m_shell_did_continue; }
void unblock() const;
Core::ElapsedTimer& timer() { return m_command_timer; }
@ -94,6 +95,7 @@ public:
void set_signalled(int sig);
void set_is_suspended(bool value) const { m_is_suspended = value; }
void set_shell_did_continue(bool value) const { m_shell_did_continue = value; }
void set_running_in_background(bool running_in_background)
{
@ -129,6 +131,7 @@ private:
Core::ElapsedTimer m_command_timer;
mutable bool m_active { true };
mutable bool m_is_suspended { false };
mutable bool m_shell_did_continue { false };
bool m_should_be_disowned { false };
OwnPtr<AST::Command> m_command;
};