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