Skip to main content

Mountain/RPC/CocoonService/Terminal/
AcceptTerminalClosed.rs

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