summaryrefslogtreecommitdiff
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/Ptys.zig6
-rw-r--r--dev/gui/gui.zig1
-rw-r--r--dev/tui/tui.zig2
3 files changed, 9 insertions, 0 deletions
diff --git a/dev/Ptys.zig b/dev/Ptys.zig
index 97c5cfde..16a31939 100644
--- a/dev/Ptys.zig
+++ b/dev/Ptys.zig
@@ -156,6 +156,12 @@ pub fn signal(p: *Ptys, id: pardes.Pane.Id, sig: pardes.PtySignal) void {
if (p.slots[id.index()]) |pt| if (!pt.cmd.exited) host_io.signalTty(pt.pid, pt.fd, sig, pt.cmd.watched);
}
+/// A daemon started since the last one died: every master told it again,
+/// as `spawn` tells the first (host_io.forkShell).
+pub fn tellDaemon(p: *const Ptys) void {
+ for (p.slots) |slot| if (slot) |pt| daemon.pty(pt.pid, pt.fd);
+}
+
/// The pane is gone, or its shell is: its reader out of the queue first
/// (which lets go one waiting for room there) and canceled; its pty hung
/// up, which the kernel passes on to the shell as SIGHUP; the daemon's
diff --git a/dev/gui/gui.zig b/dev/gui/gui.zig
index 81d58137..2aaa8bcc 100644
--- a/dev/gui/gui.zig
+++ b/dev/gui/gui.zig
@@ -3182,6 +3182,7 @@ fn deliverNote(ctx: *anyopaque, note: daemon.Note) void {
const s: *Shell = @ptrCast(@alignCast(ctx));
const q = s.queue;
switch (note) {
+ .relinked => q.wake(),
.adopted => |a| {
for (a.pids[0..a.n], a.fds[0..a.n]) |pid, fd| q.push(.{ .adopted = .{ .pid = pid, .fd = fd } });
q.push(.{ .adopted = .{ .pid = 0, .fd = -1 } });
diff --git a/dev/tui/tui.zig b/dev/tui/tui.zig
index 42f73559..c54447c7 100644
--- a/dev/tui/tui.zig
+++ b/dev/tui/tui.zig
@@ -1101,6 +1101,8 @@ fn clearNativeImages(
fn deliverNote(ctx: *anyopaque, note: daemon.Note) void {
const loop: *Loop = @ptrCast(@alignCast(ctx));
switch (note) {
+ // A full queue wakes it anyway.
+ .relinked => _ = loop.tryPostEvent(.nop) catch false,
.adopted => |a| {
for (a.pids[0..a.n], a.fds[0..a.n]) |pid, fd| loop.postEvent(.{ .adopted = .{ .pid = pid, .fd = fd } }) catch {
_ = libc.close(fd);