Skip to main content

Mountain/RPC/CocoonService/Terminal/
AcceptTerminalProcessId.rs

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