From 8dd0c391e9d816a575e888a23dd13de991e413e5 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 6 Aug 2020 15:50:57 +0200 Subject: [PATCH] Shell: Make "fg" set the TTY PGID before SIGCONT'ing the job Otherwise the child will get SIGTTIN/SIGTTOU on next TTY I/O. --- Shell/Builtin.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Shell/Builtin.cpp b/Shell/Builtin.cpp index 5cef22a449..8e547f0c0d 100644 --- a/Shell/Builtin.cpp +++ b/Shell/Builtin.cpp @@ -349,6 +349,9 @@ int Shell::builtin_fg(int argc, const char** argv) dbg() << "Resuming " << job->pid() << " (" << job->cmd() << ")"; fprintf(stderr, "Resuming job %" PRIu64 " - %s\n", job->job_id(), job->cmd().characters()); + tcsetpgrp(STDOUT_FILENO, job->pgid()); + tcsetpgrp(STDIN_FILENO, job->pgid()); + if (killpg(job->pgid(), SIGCONT) < 0) { perror("killpg"); return 1;