DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/IPC/WindServiceHandlers/Terminal/TerminalCreate.rs
1//! Spawn a new PTY through `TerminalProvider::CreateTerminal`.
2//! `Options` carries shell path, args, cwd, env, name. Returns a
3//! provider-assigned terminal id (`u64`) which Wind uses for
4//! every subsequent send/show/dispose call.
5
6use std::sync::Arc;
7
8use CommonLibrary::Terminal::TerminalProvider::TerminalProvider;
9use serde_json::Value;
10
11use crate::{
12 IPC::WindServiceHandlers::Utilities::JsonValueHelpers::arg_val,
13 RunTime::ApplicationRunTime::ApplicationRunTime,
14};
15
16pub async fn Fn(RunTime:Arc<ApplicationRunTime>, Arguments:Vec<Value>) -> Result<Value, String> {
17 let Options = arg_val(&Arguments, 0);
18
19 RunTime
20 .Environment
21 .CreateTerminal(Options)
22 .await
23 .map_err(|Error| format!("terminal:create failed: {}", Error))
24}