Force stream out path to be absolute

This commit is contained in:
Armin Ronacher 2025-06-15 23:59:40 +02:00
parent 3bf7ce2c25
commit 488585c2a1

View file

@ -50,8 +50,8 @@ fn list_sessions(control_path: &Path) -> Result<(), anyhow::Error> {
"status": session_info.status,
"exit_code": session_info.exit_code,
"started_at": session_info.started_at,
"stream-out": stream_out_path.to_string_lossy(),
"stdin": stdin_path.to_string_lossy()
"stream-out": stream_out_path.canonicalize().unwrap_or(stream_out_path.clone()).to_string_lossy(),
"stdin": stdin_path.canonicalize().unwrap_or(stdin_path.clone()).to_string_lossy()
})
} else {
// Fallback to old behavior if JSON parsing fails
@ -62,8 +62,8 @@ fn list_sessions(control_path: &Path) -> Result<(), anyhow::Error> {
};
serde_json::json!({
"status": status,
"stream-out": stream_out_path.to_string_lossy(),
"stdin": stdin_path.to_string_lossy()
"stream-out": stream_out_path.canonicalize().unwrap_or(stream_out_path.clone()).to_string_lossy(),
"stdin": stdin_path.canonicalize().unwrap_or(stdin_path.clone()).to_string_lossy()
})
}
} else {
@ -75,8 +75,8 @@ fn list_sessions(control_path: &Path) -> Result<(), anyhow::Error> {
};
serde_json::json!({
"status": status,
"stream-out": stream_out_path.to_string_lossy(),
"stdin": stdin_path.to_string_lossy()
"stream-out": stream_out_path.canonicalize().unwrap_or(stream_out_path.clone()).to_string_lossy(),
"stdin": stdin_path.canonicalize().unwrap_or(stdin_path.clone()).to_string_lossy()
})
};