DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/RPC/CocoonService/Terminal/
CloseTerminal.rs1use tonic::{Response, Status};
4use CommonLibrary::Terminal::TerminalProvider::TerminalProvider;
5
6use crate::{
7 RPC::CocoonService::CocoonServiceImpl,
8 Vine::Generated::{CloseTerminalRequest, Empty},
9 dev_log,
10};
11
12pub async fn Fn(Service:&CocoonServiceImpl, Request:CloseTerminalRequest) -> Result<Response<Empty>, Status> {
13 let TerminalIdentifier = Request.terminal_id as u64;
14
15 dev_log!("cocoon", "[CocoonService] close_terminal: id={}", TerminalIdentifier);
16
17 match Service.environment.DisposeTerminal(TerminalIdentifier).await {
18 Ok(()) => Ok(Response::new(Empty {})),
19
20 Err(Error) => {
21 dev_log!(
22 "cocoon",
23 "warn: [CocoonService] close_terminal failed id={}: {}",
24 TerminalIdentifier,
25 Error
26 );
27
28 Err(Status::internal(format!("close_terminal: {}", Error)))
29 },
30 }
31}