From 07806d12732e45b8e42350307e25fcb36c2f0f52 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 10 Nov 2019 08:49:23 +0100 Subject: [PATCH] Kernel: Process should release its TTY immediately on exit Don't wait for someone to wait() on a dead process before releasing its TTY object. This fixes the child process death detection used by the Terminal application, which relies on getting an EOF on the master PTY in order to know it's time to wait() on the child process. :^) --- Kernel/Process.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 8880bbd4b1..11ae31cf96 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -2272,6 +2272,12 @@ void Process::finalize() void Process::die() { + // Let go of the TTY, otherwise a slave PTY may keep the master PTY from + // getting an EOF when the last process using the slave PTY dies. + // If the master PTY owner relies on an EOF to know when to wait() on a + // slave owner, we have to allow the PTY pair to be torn down. + m_tty = nullptr; + if (m_tracer) m_tracer->set_dead();