Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Preserve WINDIR in core Windows shell environments (#39809)

zm-oai3cde5d4ccdc8
diff --git a/codex-rs/protocol/src/shell_environment.rs b/codex-rs/protocol/src/shell_environment.rs
index 6f886bf065..73d14a79fd 100644
--- a/codex-rs/protocol/src/shell_environment.rs
+++ b/codex-rs/protocol/src/shell_environment.rs
@@ -172,6 +172,7 @@ pub const WINDOWS_CORE_ENV_VARS: &[&str] = &[
"SHELL",
"COMSPEC",
"SYSTEMROOT",
+ "WINDIR",
"SYSTEMDRIVE",
// User context and profiles
"USERNAME",
@@ -218,6 +219,7 @@ mod windows_tests {
let vars = make_vars(&[
("Shell", "C:\\Program Files\\Git\\bin\\bash.exe"),
("SystemRoot", "C:\\Windows"),
+ ("WinDir", "C:\\Windows"),
("AppData", "C:\\Users\\codex\\AppData\\Roaming"),
("TmpDir", "C:\\Temp\\custom"),
("OPENAI_API_KEY", "secret"),
@@ -237,6 +239,7 @@ mod windows_tests {
"C:\\Program Files\\Git\\bin\\bash.exe".to_string(),
),
("SystemRoot".to_string(), "C:\\Windows".to_string()),
+ ("WinDir".to_string(), "C:\\Windows".to_string()),
(
"AppData".to_string(),
"C:\\Users\\codex\\AppData\\Roaming".to_string(),