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