Skip to content

Commit ed8bb49

Browse files
committed
fix(monitor): resize PTY to host terminal size on startup
OCI config may omit consoleSize. The child process cannot query the host terminal after setsid/pivot_root, so the parent must propagate the host terminal dimensions to the PTY master immediately when I/O forwarding is enabled — same pattern as runc's tty.resize(). Signed-off-by: Yuming He <ComixHe1895@outlook.com>
1 parent 579d4a0 commit ed8bb49

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/linyaps_box/container_monitor.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,13 @@ auto container_monitor::enable_io_forwarding(terminal_master master,
155155

156156
this->master = std::move(master);
157157

158+
// Immediately propagate the host terminal size to the PTY master,
159+
// so the terminal inside the container starts with the right dimensions
160+
// even when the OCI config does not specify consoleSize.
161+
if (host_tty && this->master) {
162+
this->master->resize(host_tty->get_size());
163+
}
164+
158165
// The PTY master fd is used bidirectionally: we write stdin into it AND
159166
// read its output back to stdout. epoll needs two independent fd
160167
// registrations, so we duplicate the master fd here.

0 commit comments

Comments
 (0)