Small refactor

This commit is contained in:
Armin Ronacher 2025-06-16 03:34:48 +02:00
parent 63d57d6ab9
commit c4e5890aa8

View file

@ -35,7 +35,6 @@ fn list_sessions(control_path: &Path) -> Result<(), anyhow::Error> {
.file_name() .file_name()
.and_then(|n| n.to_str()) .and_then(|n| n.to_str())
.unwrap_or("unknown"); .unwrap_or("unknown");
let session_json_path = path.join("session.json"); let session_json_path = path.join("session.json");
let stream_out_path = path.join("stream-out"); let stream_out_path = path.join("stream-out");
let stdin_path = path.join("stdin"); let stdin_path = path.join("stdin");
@ -61,14 +60,15 @@ fn list_sessions(control_path: &Path) -> Result<(), anyhow::Error> {
.and_then(|content| serde_json::from_str(&content).map_err(Into::into)) .and_then(|content| serde_json::from_str(&content).map_err(Into::into))
.unwrap_or_default(); .unwrap_or_default();
let session_entry = SessionListEntry { sessions.insert(
session_info, session_id.to_string(),
stream_out, SessionListEntry {
stdin, session_info,
notification_stream, stream_out,
}; stdin,
notification_stream,
sessions.insert(session_id.to_string(), serde_json::to_value(session_entry)?); },
);
} }
} }
} }