diff options
Diffstat (limited to 'src/tty/tty.zig')
| -rw-r--r-- | src/tty/tty.zig | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/tty/tty.zig b/src/tty/tty.zig index 03b7a7e2..430c020d 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -2397,23 +2397,16 @@ const Shell = struct { var buf: [96]u8 = undefined; return core.setMessage(core.active, if (s.adopted == 0) "Adopt: no shell of a session that died is waiting" else std.fmt.bufPrint(&buf, "Adopt: {d} shell{s} taken in; what they showed is gone", .{ s.adopted, if (s.adopted == 1) "" else "s" }) catch "Adopt: shells taken in"); } - var newest: u32 = 0; - for (core.panes) |slot| if (slot) |pn| { - newest = @max(newest, pn.serial); - }; if (s.adoptions_len < s.adoptions.len) { // A terminal pane, as the Tty word makes one; its spawn takes // this pty instead of forking a shell (`spawn`). s.adoptions[s.adoptions_len] = .{ .pid = pid, .fd = fd, .pane = null }; s.adoptions_len += 1; - _ = core.executeBuiltinLine(core.active, "Tty"); - for (core.panes, 0..) |slot, id| if (slot) |pn| if (pn.serial > newest and pn.isTerminal()) { - // Its shell is up already: nothing to greet with `ls`. - pn.greet = false; - s.adoptions[s.adoptions_len - 1].pane = @intCast(id); + if (core.adoptShell()) |id| { + s.adoptions[s.adoptions_len - 1].pane = id; s.adopted += 1; return; - }; + } s.adoptions_len -= 1; } // No room for it: its master goes, and the shell with this session. |
