bxctl: chat_approvals' helper accepts a broken pipe on stdin
json_prints_only_json_and_never_asks_brokerd failed once under load: the helper wrote the typed input to a `bxctl chat --json` that never reads stdin and had already exited, and unwrapped the broken pipe. A broken pipe on that write is now accepted; any other error still fails the test, and a test whose input must be read checks the output. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -398,8 +398,15 @@ fn chat(loopd: &Path, brokerd: &Path, extra: &[&str], typed: &str) -> std::proce
|
||||
.spawn()
|
||||
.unwrap();
|
||||
{
|
||||
// A `bxctl` that never reads stdin (with `--json`, or with no approval to answer) may
|
||||
// exit before the write: a broken pipe then is not an error. Anything that must be read
|
||||
// is checked by the test's own assertions on the output.
|
||||
let mut stdin = child.stdin.take().unwrap();
|
||||
stdin.write_all(typed.as_bytes()).unwrap();
|
||||
match stdin.write_all(typed.as_bytes()) {
|
||||
Ok(()) => {}
|
||||
Err(e) if e.kind() == std::io::ErrorKind::BrokenPipe => {}
|
||||
Err(e) => panic!("writing to bxctl's stdin: {e}"),
|
||||
}
|
||||
}
|
||||
child.wait_with_output().unwrap()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user