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

Shell: Avoid messing with sigaction while waiting for a child

This commit is contained in:
AnotherTest 2020-05-26 18:45:19 +04:30 committed by Andreas Kling
parent 70a213a6ec
commit d5e9213683
Notes: sideshowbarker 2024-07-19 06:05:31 +09:00
3 changed files with 10 additions and 11 deletions

View file

@ -58,7 +58,7 @@ void FileDescriptionCollector::add(int fd)
int main(int argc, char** argv)
{
Core::EventLoop loop;
signal(SIGINT, [](int) {
editor->interrupted();
});
@ -74,6 +74,8 @@ int main(int argc, char** argv)
signal(SIGCHLD, [](int) {
auto& jobs = s_shell->jobs;
for (auto& job : jobs) {
if (s_shell->is_waiting_for(job.value->pid()))
continue;
int wstatus = 0;
auto child_pid = waitpid(job.value->pid(), &wstatus, WNOHANG);
if (child_pid == job.value->pid()) {