mirror of
https://github.com/openai/codex.git
synced 2026-09-05 15:18:41 +00:00
windows-sandbox: materialize setup helper before launch
This commit is contained in:
@@ -22,18 +22,21 @@ pub(crate) const RESOURCES_DIRNAME: &str = "codex-resources";
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
||||
pub(crate) enum HelperExecutable {
|
||||
CommandRunner,
|
||||
Setup,
|
||||
}
|
||||
|
||||
impl HelperExecutable {
|
||||
fn file_name(self) -> &'static str {
|
||||
match self {
|
||||
Self::CommandRunner => "codex-command-runner.exe",
|
||||
Self::Setup => "codex-windows-sandbox-setup.exe",
|
||||
}
|
||||
}
|
||||
|
||||
fn label(self) -> &'static str {
|
||||
match self {
|
||||
Self::CommandRunner => "command-runner",
|
||||
Self::Setup => "setup-helper",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ fn run_setup_refresh_inner(
|
||||
};
|
||||
let json = serde_json::to_vec(&payload)?;
|
||||
let b64 = BASE64_STANDARD.encode(json);
|
||||
let exe = find_setup_exe();
|
||||
let exe = find_setup_exe(request.codex_home);
|
||||
let sbx_dir = sandbox_dir(request.codex_home);
|
||||
let log_path = current_log_file_path(&sbx_dir);
|
||||
let cleared_report = match clear_setup_error_report(request.codex_home) {
|
||||
@@ -662,13 +662,12 @@ fn quote_arg(arg: &str) -> String {
|
||||
out
|
||||
}
|
||||
|
||||
fn find_setup_exe() -> PathBuf {
|
||||
if let Ok(exe) = std::env::current_exe()
|
||||
&& let Some(setup_exe) = find_setup_exe_for_current_exe(&exe)
|
||||
{
|
||||
return setup_exe;
|
||||
}
|
||||
PathBuf::from(SETUP_EXE_FILENAME)
|
||||
fn find_setup_exe(codex_home: &Path) -> PathBuf {
|
||||
resolve_helper_for_launch(
|
||||
HelperExecutable::Setup,
|
||||
codex_home,
|
||||
Some(&sandbox_dir(codex_home)),
|
||||
)
|
||||
}
|
||||
|
||||
fn find_setup_exe_for_current_exe(exe: &Path) -> Option<PathBuf> {
|
||||
@@ -716,7 +715,7 @@ fn run_setup_exe(
|
||||
use windows_sys::Win32::UI::Shell::SEE_MASK_NOCLOSEPROCESS;
|
||||
use windows_sys::Win32::UI::Shell::SHELLEXECUTEINFOW;
|
||||
use windows_sys::Win32::UI::Shell::ShellExecuteExW;
|
||||
let exe = find_setup_exe();
|
||||
let exe = find_setup_exe(codex_home);
|
||||
let payload_json = serde_json::to_string(payload).map_err(|err| {
|
||||
failure(
|
||||
SetupErrorCode::OrchestratorPayloadSerializeFailed,
|
||||
|
||||
Reference in New Issue
Block a user