Hmbown/CodeWhale · error

write one input burst

Error message

write one input burst

What it means

The test writes a single concatenated burst (typed prefix + terminal reply + typed suffix) to the pipe with `writer.write(&burst).expect("write one input burst")`, asserting the write consumed every byte. The panic fires if the write fails (broken pipe, EINTR surfaced as error, writer closed) or, via the `assert_eq!`, if it was a short write.

Solutions

  1. Ensure the reader end stays open until after the write
  2. Use `write_all` to eliminate short-write failures on the assert
  3. Check burst size against the pipe buffer capacity (64 KiB on Linux) if the payload grows
  4. Retry on `ErrorKind::Interrupted`

Example fix

// before
assert_eq!(writer.write(&burst).expect("write one input burst"), burst.len());
// after
writer.write_all(&burst).expect("write one input burst");
Defensive patterns

Strategy: try-catch

Validate before calling

// Keep the reader open before writing
let _reader_keepalive = reader.try_clone().expect("reader clone");

Try / catch

writer.write_all(&burst)
    .unwrap_or_else(|e| panic!("burst write failed: {e}")); // write_all also kills short writes

Prevention

When it happens

Trigger: Reader end closed before the write completes (broken pipe/EPIPE); a partial write returning fewer bytes than `burst.len()` (large bursts over a full pipe buffer — unlikely at this size); the writer dropped mid-iteration.

Common situations: Reordering test code so the reader is dropped first; pipe buffer capacity exceeded when the burst is enlarged; platform quirks surfacing EINTR as an error.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/2a3c0bd69cbc2124. Report an issue: GitHub.

Appendix: source

Thrown at crates/palette/src/osc11_tests.rs:48

            response: b"\x1b_Gi=31;OK\x1b\\",
            reply: b"\x1b_Gi=31;OK",
            csi: false,
        },
        Case {
            query: b"\x1b[c",
            response: b"\x1b[?62;4c",
            reply: b"\x1b[?62;4c",
            csi: true,
        },
    ];

    for case in cases {
        let (mut reader, mut writer) = std::io::pipe().expect("create isolated input pipe");
        let prefix = b"/plu";
        let suffix = b"gin list\r";
        let burst = [prefix.as_slice(), case.response, suffix.as_slice()].concat();
        assert_eq!(
            writer.write(&burst).expect("write one input burst"),
            burst.len()
        );

        // Keep the writer open: a buffered read-ahead must not be rescued by
        // EOF/readable-HUP while the real tty would have no new bytes ready.
        let (answered, reply, carried) = read_terminal_reply(
            reader.as_raw_fd(),
            case.query,
            Duration::from_secs(1),
            case.csi,
        );
        drop(writer);
        let mut remaining = Vec::new();
        reader
            .read_to_end(&mut remaining)
            .expect("read remaining typed input");

        assert!(

View on GitHub (pinned to 433685b202)