fix(terminal): build terminal on macos and freebsd
This commit is contained in:
parent
b1e13f036d
commit
646db3b374
2 changed files with 8 additions and 7 deletions
|
|
@ -30,8 +30,8 @@
|
|||
.hash = "fuzzig-0.1.1-Ji0xivxIAQBD0g8O_NV_0foqoPf3elsg9Sc3pNfdVH4D",
|
||||
},
|
||||
.vaxis = .{
|
||||
.url = "git+https://github.com/neurocyte/libvaxis?ref=main#db8eee5fc5e5d1b942e57b7645b2b1e39a3e37f1",
|
||||
.hash = "vaxis-0.5.1-BWNV_LHUCQBX3VsvEzYYeHuShpG6o1br7Vc4h-wxQjJZ",
|
||||
.url = "git+https://github.com/neurocyte/libvaxis?ref=main#31e54f7d16c16b3f1a4aaf99966dadb9e5ca7a0f",
|
||||
.hash = "vaxis-0.5.1-BWNV_DzhCQDZI3Vt_DRwcmmEd_jrTyNLGPKpnOPoHQ3-",
|
||||
},
|
||||
.zeit = .{
|
||||
.url = "git+https://github.com/rockorager/zeit?ref=zig-0.15#ed2ca60db118414bda2b12df2039e33bad3b0b88",
|
||||
|
|
|
|||
|
|
@ -582,7 +582,7 @@ const pty = struct {
|
|||
},
|
||||
};
|
||||
} else if (try m.match(.{ "fd", "pty", "read_error", tp.extract(&self.err_code), tp.more })) {
|
||||
// thespian fires read_error with EPOLLHUP when the child exits cleanly.
|
||||
// thespian fires read_error when the pty fd signals an error condition
|
||||
// Treat it the same as EIO: reap the child and signal exit.
|
||||
const code = self.vt.cmd.wait();
|
||||
std.log.debug("terminal: read_error from fd (err={d}), process exited with code={d}", .{ self.err_code, code });
|
||||
|
|
@ -615,10 +615,11 @@ const pty = struct {
|
|||
while (true) {
|
||||
const n = std.posix.read(self.vt.ptyFd(), &buf) catch |e| switch (e) {
|
||||
error.WouldBlock => {
|
||||
// No more data right now. Check if the child already exited -
|
||||
// on Linux a clean exit may not make the pty fd readable again
|
||||
// (no EPOLLIN), it just starts returning EIO on the next read.
|
||||
// Polling here catches that case before we arm wait_read again.
|
||||
// No more data right now. On Linux, a clean child exit may not
|
||||
// generate a readable event on the pty master - it just starts
|
||||
// returning EIO. Poll for exit here before sleeping in wait_read.
|
||||
// On macOS/FreeBSD the pty master raises EIO directly, so the
|
||||
// try_wait check here is just an extra safety net.
|
||||
if (self.vt.cmd.try_wait()) |code| {
|
||||
std.log.debug("terminal: child exited (detected via try_wait) with code={d}", .{code});
|
||||
self.vt.event_queue.push(.{ .exited = code });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue