Skip to main content

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