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};
7use ::Vine::Generated::{Empty, TerminalClosedNotification};
8
9use crate::{RPC::CocoonService::CocoonServiceImpl, dev_log};
10
11pub async fn Fn(Service:&CocoonServiceImpl, Request:TerminalClosedNotification) -> Result<Response<Empty>, Status> {
12	dev_log!("cocoon", "[CocoonService] Terminal closed: {}", Request.terminal_id);
13
14	let _ = Service
15		.environment
16		.ApplicationHandle
17		.emit("sky://terminal/exit", json!({ "id": Request.terminal_id }));
18
19	Ok(Response::new(Empty {}))
20}