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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user