mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
## Why MXC launch errors omit the native Windows error code, while the SDK diagnostics can contain command, environment, and working-directory data. ## What changed Extract the numeric error code from recognized `CreateProcessW` failures and append it to the launch error without exposing the remaining SDK diagnostics. Preserve the existing error message when no code can be extracted. ## Testing Add unit tests for extracting the code without trailing diagnostics and rejecting nonnumeric codes and errors from other APIs. GitOrigin-RevId: ddfa6635ab4fe9293ab4d31f9fcd7cfe563d4928
21 lines
536 B
Rust
21 lines
536 B
Rust
#![cfg(test)]
|
|
|
|
use super::create_process_error;
|
|
|
|
#[test]
|
|
fn returns_only_the_native_create_process_error() {
|
|
let api = "CreateProcessW(PROC_THREAD_ATTRIBUTE_SECURITY_ENVIRONMENT) failed: ";
|
|
assert_eq!(
|
|
create_process_error(&format!("{api}WIN32_ERROR(5) (working directory: private)")),
|
|
Some(5)
|
|
);
|
|
assert_eq!(
|
|
create_process_error(&format!("{api}WIN32_ERROR(private)")),
|
|
None
|
|
);
|
|
assert_eq!(
|
|
create_process_error("another API failed: WIN32_ERROR(5)"),
|
|
None
|
|
);
|
|
}
|