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?
This commit is contained in:
parent
f9d2fc7532
commit
d36be9048c
1 changed files with 3 additions and 0 deletions
|
@ -89,6 +89,9 @@ pub fn deinit(self: *Terminal) void {
|
||||||
self.should_quit = true;
|
self.should_quit = true;
|
||||||
self.cmd.kill();
|
self.cmd.kill();
|
||||||
if (self.thread) |thread| {
|
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();
|
thread.join();
|
||||||
self.thread = null;
|
self.thread = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue