fix: prevent daemon panic on broken stderr pipe during Chrome launch (#802)
Replace all `eprintln!` calls in daemon-context code with `let _ = writeln!(std::io::stderr(), ...)` so that broken pipe errors on stderr are silently ignored instead of panicking. The CLI client spawns the daemon with piped stderr to capture startup errors, then drops the pipe handle once the daemon is ready. Any subsequent `eprintln!` in the daemon panics because Rust's `eprintln!` macro internally unwraps the write result. This caused the reported "failed printing to stderr: Broken pipe (os error 32)" panic during Chrome launch on Linux. Closes #799 Co-authored-by: ctate <366502+ctate@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use std::io::Write;
|
||||
use std::sync::atomic::{AtomicI64, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -87,7 +88,7 @@ async fn accept_loop(
|
||||
|
||||
tokio::spawn(async move {
|
||||
if let Err(e) = handle_connection(stream, proxy, tid, chp, proxy_port).await {
|
||||
eprintln!("[inspect] connection error: {}", e);
|
||||
let _ = writeln!(std::io::stderr(), "[inspect] connection error: {}", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -233,7 +234,8 @@ async fn handle_ws_proxy(
|
||||
let raw_msg = match raw_rx.recv().await {
|
||||
Ok(msg) => msg,
|
||||
Err(tokio::sync::broadcast::error::RecvError::Lagged(n)) => {
|
||||
eprintln!(
|
||||
let _ = writeln!(
|
||||
std::io::stderr(),
|
||||
"[inspect] warning: dropped {} CDP messages (channel lag)",
|
||||
n
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user