tty: do not close /dev/tty on macos
Attempting to close /dev/tty may block indefinitely on macos if another thread is already blocked on a read operation. As there is no practical use for closing /dev/tty on exit besides unblocking other threads (which does not work on macos anyway) we can just skip the close call.
This commit is contained in:
parent
55809160b9
commit
1c11333717
1 changed files with 2 additions and 1 deletions
|
@ -73,6 +73,7 @@ pub fn deinit(self: *Tty) void {
|
||||||
posix.tcsetattr(self.fd, .FLUSH, self.termios) catch |err| {
|
posix.tcsetattr(self.fd, .FLUSH, self.termios) catch |err| {
|
||||||
log.err("couldn't restore terminal: {}", .{err});
|
log.err("couldn't restore terminal: {}", .{err});
|
||||||
};
|
};
|
||||||
|
if (builtin.os.tag != .macos) // closing /dev/tty may block indefinitely on macos
|
||||||
posix.close(self.fd);
|
posix.close(self.fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue