summaryrefslogtreecommitdiff
path: root/src/tty
diff options
context:
space:
mode:
Diffstat (limited to 'src/tty')
-rw-r--r--src/tty/tty.zig10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/tty/tty.zig b/src/tty/tty.zig
index 37f66456..31f62d34 100644
--- a/src/tty/tty.zig
+++ b/src/tty/tty.zig
@@ -122,6 +122,8 @@ fn stopInput(loop: *Loop) void {
}
fn inputThread(loop: *Loop, cache: *vaxis.GraphemeCache) void {
+ // vaxis's test terminal reads nothing off Linux: it has no read at all.
+ if (comptime !@hasDecl(vaxis.Tty, "read")) return;
inputReader(loop, loop.tty, cache);
}
@@ -1185,6 +1187,10 @@ pub fn run(init: std.process.Init, opts: pardes.Options, term: Term) !void {
// Kept by a daemon, a hangup is the terminal's end, not the session's:
// winchWatch takes it, and the session carries on detached.
if (daemon.link >= 0) posix.sigaddset(&winch_set, posix.SIG.HUP);
+ // FreeBSD drops a signal whose action is to be ignored (WINCH's
+ // default) as it is sent, sigwait or not: a handler keeps it.
+ if (comptime builtin.os.tag == .freebsd)
+ posix.sigaction(.WINCH, &.{ .handler = .{ .handler = keepSignal }, .mask = posix.sigemptyset(), .flags = 0 }, null);
posix.sigprocmask(posix.SIG.BLOCK, &winch_set, null);
var tty_buf: [0x10000]u8 = undefined;
@@ -2450,7 +2456,7 @@ fn lspStatusSink(ctx: ?*anyopaque, text: []const u8) void {
}
fn watchFiles(io: std.Io, fd: c_int, loop: *Loop) anyerror!void {
- if (comptime builtin.os.tag != .linux) {
+ if (comptime builtin.os.tag != .linux and builtin.os.tag != .freebsd) {
while (file_watch.wait(fd)) loop.postEvent(.files_changed) catch break;
return;
}
@@ -2465,6 +2471,8 @@ fn watchFiles(io: std.Io, fd: c_int, loop: *Loop) anyerror!void {
}
}
+fn keepSignal(_: posix.SIG) callconv(.c) void {}
+
fn winchWatch(loop: *Loop, vx: *vaxis.Vaxis, tty: *vaxis.Tty) void {
var set = posix.sigemptyset();
posix.sigaddset(&set, posix.SIG.WINCH);