Skip to main content

Mountain/RPC/CocoonService/Terminal/
AcceptTerminalClosed.rs

1//! Forward a terminal-closed notification to Sky on `sky://terminal/exit`.
2//! (`/closed` had no consumer.)
3
4use serde_json::json;
5use tauri::Emitter;
6use tonic::{Response, Status};
7
8use crate::{
9	RPC::CocoonService::CocoonServiceImpl,
10	Vine::Generated::{Empty, TerminalClosedNotification},
11	dev_log,
12};
13
14pub async fn Fn(Service:&CocoonServiceImpl, Request:TerminalClosedNotification) -> Result<Response<Empty>, Status> {
15	dev_log!("cocoon", "[CocoonService] Terminal closed: {}", Request.terminal_id);
16
17	let _ = Service
18		.environment
19		.ApplicationHandle
20		.emit("sky://terminal/exit", json!({ "id": Request.terminal_id }));
21
22	Ok(Response::new(Empty {}))
23}