mirror of
https://github.com/openai/codex.git
synced 2026-10-21 04:45:00 +00:00
Preserve Windows sandbox runner launch errors (#49261)
## Why Restoring the error mode with `SetErrorMode` can overwrite the failure code from `CreateProcessWithLogonW`, causing `RunnerLogonError` to report the wrong error. ## What changed Capture `GetLastError()` immediately after a failed runner launch, before restoring the previous error mode, and use the saved code for `RunnerLogonError`. GitOrigin-RevId: c0f4267232306be4d06e7e8accd60f7b77b8d6f3
This commit is contained in:
@@ -409,11 +409,12 @@ pub(crate) fn spawn_runner_transport(
|
||||
&mut pi,
|
||||
)
|
||||
};
|
||||
// Preserve the failure code before SetErrorMode can overwrite it.
|
||||
let spawn_error = (spawn_res == 0).then(|| unsafe { GetLastError() });
|
||||
unsafe {
|
||||
SetErrorMode(previous_error_mode);
|
||||
}
|
||||
if spawn_res == 0 {
|
||||
let err = unsafe { GetLastError() };
|
||||
if let Some(err) = spawn_error {
|
||||
return Err(RunnerLogonError { code: err }.into());
|
||||
}
|
||||
// Keep the process pinned through the entire startup handshake. Pipes close
|
||||
|
||||
Reference in New Issue
Block a user