More no-window flags (#7122)

This commit is contained in:
Jack Amadeo
2026-02-11 12:43:18 -05:00
committed by GitHub
parent 1aacd56225
commit fb47728f1b
12 changed files with 90 additions and 3 deletions
+4
View File
@@ -6,6 +6,8 @@ use tokio::process::Command;
use tokio::sync::Mutex;
use tracing::{debug, info, warn};
use crate::subprocess::SubprocessExt;
use crate::agents::types::SessionConfig;
use crate::agents::types::{
RetryConfig, SuccessCheck, DEFAULT_ON_FAILURE_TIMEOUT_SECONDS, DEFAULT_RETRY_TIMEOUT_SECONDS,
@@ -243,6 +245,8 @@ pub async fn execute_shell_command(
cmd
};
cmd.set_no_window();
let output = cmd
.stdout(Stdio::piped())
.stderr(Stdio::piped())
+3
View File
@@ -4,6 +4,8 @@ use crate::config::paths::Paths;
use crate::config::{get_enabled_extensions, Config};
use crate::session::session_manager::CURRENT_SCHEMA_VERSION;
use crate::session::SessionManager;
#[cfg(target_os = "windows")]
use crate::subprocess::SubprocessExt;
use chrono::{DateTime, Utc};
use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};
@@ -141,6 +143,7 @@ fn get_platform_version() -> Option<String> {
{
std::process::Command::new("cmd")
.args(["/C", "ver"])
.set_no_window()
.output()
.ok()
.and_then(|o| String::from_utf8(o.stdout).ok())
+2
View File
@@ -1,3 +1,4 @@
use crate::subprocess::SubprocessExt;
use chrono;
use serde::Deserialize;
use std::sync::Arc;
@@ -134,6 +135,7 @@ impl AzureAuth {
"--resource",
"https://cognitiveservices.azure.com",
])
.set_no_window()
.output()
.await
.map_err(|e| AuthError::TokenExchange(format!("Failed to execute Azure CLI: {}", e)))?;
+27 -3
View File
@@ -3,13 +3,37 @@ use tokio::process::Command;
#[cfg(windows)]
const CREATE_NO_WINDOW_FLAG: u32 = 0x08000000;
pub trait SubprocessExt {
fn set_no_window(&mut self) -> &mut Self;
}
impl SubprocessExt for Command {
fn set_no_window(&mut self) -> &mut Self {
#[cfg(windows)]
{
use std::os::windows::process::CommandExt;
self.creation_flags(CREATE_NO_WINDOW_FLAG);
}
self
}
}
impl SubprocessExt for std::process::Command {
fn set_no_window(&mut self) -> &mut Self {
#[cfg(windows)]
{
use std::os::windows::process::CommandExt;
self.creation_flags(CREATE_NO_WINDOW_FLAG);
}
self
}
}
#[allow(unused_variables)]
pub fn configure_subprocess(command: &mut Command) {
// Isolate subprocess into its own process group so it does not receive
// SIGINT when the user presses Ctrl+C in the terminal.
#[cfg(unix)]
command.process_group(0);
#[cfg(windows)]
command.creation_flags(CREATE_NO_WINDOW_FLAG);
command.set_no_window();
}