Merge pull request #3367 from davidmann4/fix/automation-unasked-line-one-write

automation: write the unasked-line test's line in one write so it stops failing with BrokenPipe
This commit is contained in:
David Mann authored and GitHub committed 2026-11-24 18:27:38 +01:00
commit ea00a61906
1 file changed
+4 -1
+4 -1
View File
@@ -88,7 +88,10 @@ fn an_unasked_line_makes_the_connection_unusable_before_sending() {
reader.read_line(&mut line).unwrap();
writeln!(out, "{}", json!({"id": 1, "ok": true})).unwrap();
wait.recv().unwrap();
writeln!(out, "{}", json!({"id": null, "ok": false, "error": "idle connection closed"})).unwrap();
// One write: `writeln!` on a bare stream sends the line and its newline apart, and the client closes on
// the first bytes, so the newline met a reset (BrokenPipe) now and then.
let unasked = format!("{}\n", json!({"id": null, "ok": false, "error": "idle connection closed"}));
out.write_all(unasked.as_bytes()).unwrap();
out.flush().unwrap();
// The client's close shows as an end of input or, with the unread line, a reset.
line.clear();