ask: the binary reads --system-file through the capped reader

main.rs still called read_to_string, leaving read_system_file dead. Binary-level
tests cover a FIFO, /dev/zero, 64KiB+1 and exactly 64KiB.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Eureka 2026-11-11 08:14:44 +00:00
commit 2a65c4e7a2
2 changed files with 64 additions and 3 deletions

View file

@ -102,9 +102,7 @@ fn run_ask(args: &[&str]) -> Result<(), Failure> {
flags.single.get("--system-file"),
) {
(Some(text), None) => text.clone(),
(None, Some(path)) => {
std::fs::read_to_string(path).map_err(|_| Failure::Malformed("--system-file"))?
}
(None, Some(path)) => ask::read_system_file(std::path::Path::new(path))?,
_ => return Err(Failure::Missing("--system or --system-file (exactly one)")),
};
let effort = match flags.single.get("--effort").map(String::as_str) {