From d36be9048c024a1e3586852c8012b2d6ec9f2e0b Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Fri, 7 Jun 2024 12:53:18 -0500 Subject: [PATCH] widgets(terminal): allow for always joining thread Write an EOT into the tty stream so after killing the process we *always* are able to join the thread. Maybe this is the very reason the EOT control byte exists? --- src/widgets/terminal/Terminal.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/widgets/terminal/Terminal.zig b/src/widgets/terminal/Terminal.zig index 6547372..df27ba6 100644 --- a/src/widgets/terminal/Terminal.zig +++ b/src/widgets/terminal/Terminal.zig @@ -89,6 +89,9 @@ pub fn deinit(self: *Terminal) void { self.should_quit = true; self.cmd.kill(); if (self.thread) |thread| { + // write an EOT into the tty to trigger a read on our thread + const EOT = "\x04"; + _ = std.posix.write(self.pty.tty, EOT) catch {}; thread.join(); self.thread = null; }