Mountain/IPC/WindServiceHandlers/Terminal/
LocalPTYCreateProcess.rs1#![allow(unused_variables, dead_code, unused_imports)]
2
3use std::sync::Arc;
11
12use serde_json::Value;
13
14use crate::{
15 IPC::WindServiceHandlers::Terminal::TerminalCreate::Fn as TerminalCreate,
16 RunTime::ApplicationRunTime::ApplicationRunTime,
17};
18
19pub async fn Fn(RunTime:Arc<ApplicationRunTime>, Arguments:Vec<Value>) -> Result<Value, String> {
20 match TerminalCreate(RunTime, Arguments).await {
21 Ok(Response) => {
22 let TerminalIdOption = Response.get("id").and_then(serde_json::Value::as_u64);
23
24 match TerminalIdOption {
25 Some(TerminalId) if TerminalId > 0 => Ok(serde_json::json!(TerminalId)),
26
27 Some(_) | None => {
28 crate::dev_log!(
33 "terminal",
34 "error: [localPty:createProcess] CreateTerminal returned no usable id; response={:?}",
35 Response
36 );
37
38 Err(format!(
39 "localPty:createProcess: CreateTerminal returned no terminal id (response={})",
40 Response
41 ))
42 },
43 }
44 },
45
46 Err(Error) => Err(Error),
47 }
48}