Fix sidecar.log not created: ensure data dir exists
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -236,13 +236,18 @@ impl SidecarManager {
|
|||||||
|
|
||||||
// Log sidecar stderr to a file for diagnostics
|
// Log sidecar stderr to a file for diagnostics
|
||||||
let stderr_cfg = if let Some(data_dir) = DATA_DIR.get() {
|
let stderr_cfg = if let Some(data_dir) = DATA_DIR.get() {
|
||||||
|
let _ = std::fs::create_dir_all(data_dir);
|
||||||
let log_path = data_dir.join("sidecar.log");
|
let log_path = data_dir.join("sidecar.log");
|
||||||
eprintln!("[sidecar-rs] Sidecar stderr → {}", log_path.display());
|
eprintln!("[sidecar-rs] Sidecar stderr → {}", log_path.display());
|
||||||
match std::fs::File::create(&log_path) {
|
match std::fs::File::create(&log_path) {
|
||||||
Ok(f) => Stdio::from(f),
|
Ok(f) => Stdio::from(f),
|
||||||
Err(_) => Stdio::inherit(),
|
Err(e) => {
|
||||||
|
eprintln!("[sidecar-rs] Failed to create sidecar.log: {e}");
|
||||||
|
Stdio::inherit()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
eprintln!("[sidecar-rs] DATA_DIR not set, sidecar stderr will not be logged");
|
||||||
Stdio::inherit()
|
Stdio::inherit()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user