Mountain/IPC/WindServiceHandlers/Terminal/TerminalHide.rs
1
2//! Hide a terminal panel without disposing the underlying PTY.
3//! The child process keeps running; subsequent `TerminalShow`
4//! reopens the same session. Mirrors
5//! `vscode.Terminal.hide()`.
6
7use std::sync::Arc;
8
9use CommonLibrary::Terminal::TerminalProvider::TerminalProvider;
10use serde_json::Value;
11
12use crate::RunTime::ApplicationRunTime::ApplicationRunTime;
13
14pub async fn Fn(RunTime:Arc<ApplicationRunTime>, Arguments:Vec<Value>) -> Result<Value, String> {
15 let TerminalId = Arguments.first().and_then(|V| V.as_u64()).unwrap_or(0);
16
17 RunTime
18 .Environment
19 .HideTerminal(TerminalId)
20 .await
21 .map(|()| Value::Null)
22 .map_err(|Error| format!("terminal:hide failed: {}", Error))
23}