mirror of
https://github.com/openai/codex.git
synced 2026-11-18 07:00:27 +00:00
Keep the Windows sandbox command runner hidden (#42801)
## What changed - Build `codex-command-runner` as a Windows-subsystem binary outside tests. - Launch non-TTY sandbox commands without a console window. - Suppress the busy cursor when creating the elevated runner process. GitOrigin-RevId: fc6b70059add7dea642805030bd508915367fe44
This commit is contained in:
1 parent
80ab0ffafe
commit
89a4eec6da
3 files changed
+5
-8
No files matched your search
@@ -1,3 +1,5 @@
|
|||||||
|
#![cfg_attr(all(target_os = "windows", not(test)), windows_subsystem = "windows")]
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
mod win;
|
mod win;
|
||||||
|
|
||||||
|
|||||||
@@ -77,9 +77,6 @@ use windows_sys::Win32::System::Threading::PROCESS_INFORMATION;
|
|||||||
use windows_sys::Win32::System::Threading::TerminateProcess;
|
use windows_sys::Win32::System::Threading::TerminateProcess;
|
||||||
use windows_sys::Win32::System::Threading::WaitForSingleObject;
|
use windows_sys::Win32::System::Threading::WaitForSingleObject;
|
||||||
|
|
||||||
// Kept in sync with codex_exec_server::CODEX_FS_HELPER_ARG1 without introducing
|
|
||||||
// a dependency cycle.
|
|
||||||
const FS_HELPER_ARG: &str = "--codex-run-as-fs-helper";
|
|
||||||
const READ_ACL_MUTEX_NAME: &str = "Local\\CodexSandboxReadAcl";
|
const READ_ACL_MUTEX_NAME: &str = "Local\\CodexSandboxReadAcl";
|
||||||
const TERMINATION_WAIT_MS: u32 = 5_000;
|
const TERMINATION_WAIT_MS: u32 = 5_000;
|
||||||
const WAIT_TIMEOUT: u32 = 0x0000_0102;
|
const WAIT_TIMEOUT: u32 = 0x0000_0102;
|
||||||
@@ -355,11 +352,7 @@ fn spawn_ipc_process(req: &SpawnRequest) -> Result<IpcSpawnedProcess> {
|
|||||||
&req.env,
|
&req.env,
|
||||||
stdin_mode,
|
stdin_mode,
|
||||||
StderrMode::Separate,
|
StderrMode::Separate,
|
||||||
if req.command.get(1).is_some_and(|arg| arg == FS_HELPER_ARG) {
|
ConsoleMode::NoWindow,
|
||||||
ConsoleMode::NoWindow
|
|
||||||
} else {
|
|
||||||
ConsoleMode::Inherit
|
|
||||||
},
|
|
||||||
desktop,
|
desktop,
|
||||||
Some(log_dir.as_path()),
|
Some(log_dir.as_path()),
|
||||||
)?;
|
)?;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ use windows_sys::Win32::System::Threading::CreateProcessWithLogonW;
|
|||||||
use windows_sys::Win32::System::Threading::GetCurrentProcess;
|
use windows_sys::Win32::System::Threading::GetCurrentProcess;
|
||||||
use windows_sys::Win32::System::Threading::GetCurrentThread;
|
use windows_sys::Win32::System::Threading::GetCurrentThread;
|
||||||
use windows_sys::Win32::System::Threading::PROCESS_INFORMATION;
|
use windows_sys::Win32::System::Threading::PROCESS_INFORMATION;
|
||||||
|
use windows_sys::Win32::System::Threading::STARTF_FORCEOFFFEEDBACK;
|
||||||
use windows_sys::Win32::System::Threading::STARTUPINFOW;
|
use windows_sys::Win32::System::Threading::STARTUPINFOW;
|
||||||
use windows_sys::Win32::System::Threading::TerminateProcess;
|
use windows_sys::Win32::System::Threading::TerminateProcess;
|
||||||
use windows_sys::Win32::System::Threading::WaitForSingleObject;
|
use windows_sys::Win32::System::Threading::WaitForSingleObject;
|
||||||
@@ -350,6 +351,7 @@ pub(crate) fn spawn_runner_transport(
|
|||||||
let password_w = to_wide(&sandbox_creds.password);
|
let password_w = to_wide(&sandbox_creds.password);
|
||||||
let mut si: STARTUPINFOW = unsafe { std::mem::zeroed() };
|
let mut si: STARTUPINFOW = unsafe { std::mem::zeroed() };
|
||||||
si.cb = std::mem::size_of::<STARTUPINFOW>() as u32;
|
si.cb = std::mem::size_of::<STARTUPINFOW>() as u32;
|
||||||
|
si.dwFlags = STARTF_FORCEOFFFEEDBACK;
|
||||||
let mut pi: PROCESS_INFORMATION = unsafe { std::mem::zeroed() };
|
let mut pi: PROCESS_INFORMATION = unsafe { std::mem::zeroed() };
|
||||||
let env_block: Option<Vec<u16>> = None;
|
let env_block: Option<Vec<u16>> = None;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user