toolkit: no thread panic in http_fetch, no casts, exact egress-proxy form

Implemented-By: OpenCode session (model recorded in docs/implementer-log.md)
This commit is contained in:
2026-09-23 16:13:43 -07:00
parent e69ba632e6
commit 9662966b45
6 changed files with 62 additions and 4 deletions
+10 -1
View File
@@ -80,7 +80,16 @@ pub fn fetch_with(curl: &Path, args: &HttpFetchArgs) -> Outcome {
Some(r) => r,
None => return Outcome::tool_error("http_fetch: curl has no standard error".to_string()),
};
let stderr_handle = std::thread::spawn(move || read_capped(stderr_reader));
// `Builder`, not `spawn`, which panics when the system refuses a thread.
let stderr_handle = match std::thread::Builder::new().spawn(move || read_capped(stderr_reader))
{
Ok(handle) => handle,
Err(e) => {
let _ = child.kill();
let _ = child.wait();
return Outcome::tool_error(format!("http_fetch: cannot start a thread: {e}"));
}
};
let mut body = Vec::new();
let mut stdout = match child.stdout.take() {