szn

Bug 124 — server/pty.zig — writeInput doesn’t verify all bytes were written

124. server/pty.zig — writeInput doesn’t verify all bytes were written

File: src/server/pty.zig:202–205 Severity: MEDIUM Status: ✅ FIXED — added retry loop with partial write handling and EINTR recovery. Pipe-based test added.

pub fn writeInput(self: *Pty, data: []const u8) Error!void {
    const n = write(self.master, data.ptr, data.len);
    if (n < 0) return error.WriteFailed;
}

If write() returns 0 <= n < data.len, the remaining bytes are silently dropped. For PTY master writes (sending keystrokes to the child process), this means input can be lost without any error or retry.