Skip to content

Commit 259a28a

Browse files
committed
fix(windows): CREATE_NO_WINDOW for MCP and system rg children
Nested CreateProcess sites still flash consoles when the parent is windowless: buzz-agent MCP spawns and buzz-dev-mcp delegated rg. Refs: PR block#2247 review, block#2292 Signed-off-by: Thomas Zarebczan <[email protected]>
1 parent 924778e commit 259a28a

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

‎crates/buzz-agent/src/mcp.rs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,13 @@ async fn spawn_one(
732732
#[cfg(unix)]
733733
cmd.process_group(0);
734734

735+
// Windowless buzz-acp parent: MCP children must not allocate consoles.
736+
#[cfg(windows)]
737+
{
738+
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
739+
cmd.creation_flags(CREATE_NO_WINDOW);
740+
}
741+
735742
let transport = TokioChildProcess::new(cmd)
736743
.map_err(|e| AgentError::Mcp(format!("spawn {}: {e}", spec.name)))?;
737744
let pgid = transport.id();

‎crates/buzz-dev-mcp/src/rg.rs‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@ fn try_system_rg(args: &[String]) -> Option<i32> {
2121
let cleaned_path = clean_path(&self_canon);
2222
let candidate = which_rg(&cleaned_path)?;
2323

24-
let status = Command::new(&candidate)
25-
.args(args)
26-
.env("PATH", &cleaned_path)
27-
.status()
28-
.ok()?;
24+
let mut cmd = Command::new(&candidate);
25+
cmd.args(args).env("PATH", &cleaned_path);
26+
#[cfg(windows)]
27+
{
28+
use std::os::windows::process::CommandExt;
29+
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
30+
cmd.creation_flags(CREATE_NO_WINDOW);
31+
}
32+
let status = cmd.status().ok()?;
2933
Some(status.code().unwrap_or(2))
3034
}
3135

0 commit comments

Comments
 (0)