From 5ea4057ec5b656172e92f03aafc9c3631540bfd2 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Wed, 28 Oct 2026 19:33:26 -0700 Subject: [PATCH] fix(e2e): give the guest agent no console window The agent opened a console, which the daemon under test tiled as a window of its own, so every scenario saw one window too many. Build it as a windows subsystem program and start its children with CREATE_NO_WINDOW. --- e2e/guest/agent/src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/e2e/guest/agent/src/main.rs b/e2e/guest/agent/src/main.rs index 04031196..3de2741c 100644 --- a/e2e/guest/agent/src/main.rs +++ b/e2e/guest/agent/src/main.rs @@ -14,6 +14,8 @@ //! host (QMP), which also works at the lock screen. #![cfg(windows)] +// no console window: it would be a window for the daemon to tile +#![windows_subsystem = "windows"] use std::io::BufRead; use std::io::BufReader; @@ -21,6 +23,7 @@ use std::io::Read; use std::io::Write; use std::net::TcpListener; use std::net::TcpStream; +use std::os::windows::process::CommandExt; use std::process::Command; use serde::Deserialize; @@ -54,6 +57,9 @@ use windows::core::BOOL; const DEFAULT_PORT: u16 = 7878; +/// `CREATE_NO_WINDOW`: a child must not open a console of its own either. +const NO_WINDOW: u32 = 0x0800_0000; + #[derive(Deserialize)] struct Request { id: Value, @@ -183,6 +189,7 @@ fn exec(args: &[String]) -> Result { let (program, rest) = args.split_first().ok_or("exec wants a program")?; let out = Command::new(program) .args(rest) + .creation_flags(NO_WINDOW) .output() .map_err(|e| format!("{program}: {e}"))?; Ok(json!({ @@ -197,6 +204,7 @@ fn spawn(args: &[String]) -> Result { let (program, rest) = args.split_first().ok_or("spawn wants a program")?; let child = Command::new(program) .args(rest) + .creation_flags(NO_WINDOW) .spawn() .map_err(|e| format!("{program}: {e}"))?; Ok(json!({"pid": child.id()}))