mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
Suppress Windows console windows for background subprocesses (#49164)
## Why Background helpers launched from a detached Windows process can allocate console windows. Job Object launches and containment fallbacks need to preserve console suppression as well. ## What changed - Add `codex_utils_process::background_command` to set `CREATE_NO_WINDOW` on Windows, and use it across background subprocess launches, including Git, plugins, authentication, diagnostics, and sandbox helpers. - Centralize console suppression in Job Object launches. Keep `CREATE_NO_WINDOW` when retrying without containment, and clear `CREATE_SUSPENDED` so the fallback child can run. - Preserve console inheritance for interactive shell launches and interactive AWS authentication refreshes. ## Testing Add Windows regression tests covering console-free launches from detached parents through standard and Tokio commands, stdout/stderr capture, successful containment, Job Object creation and assignment failures, and sandbox setup refresh helpers. GitOrigin-RevId: b2c238fa7d4f9fbd868e5adf7d4be9958ff01e6c
This commit is contained in:
@@ -838,7 +838,9 @@ fn is_rendezvous_harness_url(websocket_url: &str) -> bool {
|
||||
}
|
||||
|
||||
fn stdio_command_process(stdio_command: &StdioExecServerCommand) -> Command {
|
||||
let mut command = Command::new(&stdio_command.program);
|
||||
let mut command = Command::from(codex_utils_process::background_command(
|
||||
&stdio_command.program,
|
||||
));
|
||||
command.args(&stdio_command.args);
|
||||
command.envs(&stdio_command.env);
|
||||
scrub_non_inheritable_env_vars(command.as_std_mut());
|
||||
|
||||
@@ -252,7 +252,7 @@ fn kill_direct_child(child_process: &mut Child, action: &str) {
|
||||
#[cfg(windows)]
|
||||
fn kill_windows_process_tree(pid: u32) -> bool {
|
||||
let pid = pid.to_string();
|
||||
match std::process::Command::new("taskkill")
|
||||
match codex_utils_process::background_command("taskkill")
|
||||
.args(["/PID", pid.as_str(), "/T", "/F"])
|
||||
.stdin(Stdio::null())
|
||||
.stdout(Stdio::null())
|
||||
|
||||
Reference in New Issue
Block a user