SIGWINCH writes \x1b[14t directly to stdout_fd, bypassing out_bufc.write(stdout_fd, "\x1b[14t", 5) can interleave with queued out_buf framesSeverity: MEDIUM
Status: ✅ RESOLVED
Files: src/main.zig:1004-1009
In runInteractiveLoopWithInitialCommand (src/main.zig:707), stdout_fd is placed in O_NONBLOCK mode and all server render frames are queued through out_buf and drained via flushOutBuf.
However, when SIGWINCH fires (src/main.zig:1004-1009):
if (ws.ws_xpixel > 0 and ws.ws_ypixel > 0 and ws.ws_col > 0 and ws.ws_row > 0) {
client.sendCellSize(fd, ws.ws_xpixel / ws.ws_col, ws.ws_ypixel / ws.ws_row) catch {};
} else {
_ = c.write(stdout_fd, "\x1b[14t", 5);
}
Writing "\x1b[14t" directly via c.write(stdout_fd, ...) while out_buf.items.len > out_head injects \x1b[14t into the middle of whatever escape sequence or sixel stream was partially written to stdout_fd before EAGAIN, corrupting the terminal stream (or silently dropping the query if stdout_fd is still returning EAGAIN).
Append "\x1b[14t" to out_buf and call flushOutBuf(stdout_fd, &out_buf, &out_head) instead of calling c.write(stdout_fd, ...) directly.