summaryrefslogtreecommitdiff
path: root/Shell
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-08-06 15:50:57 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-06 15:50:57 +0200
commit8dd0c391e9d816a575e888a23dd13de991e413e5 (patch)
tree338c0fab498cfcd2aa9a3f7f6b12832885852b62 /Shell
parent0c6ce063e66ae2be3d9c2f8399a84c52f83f8450 (diff)
downloadserenity-8dd0c391e9d816a575e888a23dd13de991e413e5.zip
Shell: Make "fg" set the TTY PGID before SIGCONT'ing the job
Otherwise the child will get SIGTTIN/SIGTTOU on next TTY I/O.
Diffstat (limited to 'Shell')
-rw-r--r--Shell/Builtin.cpp3
1 files changed, 3 insertions, 0 deletions
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;