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:
@@ -3,6 +3,7 @@ use base64::{engine::general_purpose::STANDARD, Engine};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{json, Value};
|
||||
use std::fs;
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@@ -137,7 +138,8 @@ fn ensure_encryption_key() -> Result<Vec<u8>, String> {
|
||||
let _ = fs::set_permissions(&key_file, fs::Permissions::from_mode(0o600));
|
||||
}
|
||||
|
||||
eprintln!(
|
||||
let _ = writeln!(
|
||||
std::io::stderr(),
|
||||
"[agent-browser] Auto-generated encryption key at {} -- back up this file or set {}",
|
||||
key_file.display(),
|
||||
ENCRYPTION_KEY_ENV
|
||||
|
||||
Reference in New Issue
Block a user