Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion codex-cli/bin/codex.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ const binaryPath = path.join(archRoot, "codex", codexBinaryName);
function getUpdatedPath(newDirs) {
const pathSep = process.platform === "win32" ? ";" : ":";
const existingPath = process.env.PATH || "";
// Preserve caller PATH precedence by appending any additional dirs.
const updatedPath = [
...newDirs,
...existingPath.split(pathSep).filter(Boolean),
...newDirs,
].join(pathSep);
return updatedPath;
}
Expand Down
4 changes: 3 additions & 1 deletion codex-rs/arg0/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,11 @@ fn prepend_path_entry_for_apply_patch() -> std::io::Result<TempDir> {
const PATH_SEPARATOR: &str = ";";

let path_element = path.display();
// Append our temp dir to PATH rather than prepending to avoid
// disturbing user PATH ordering (e.g., virtualenvs, shims).
let updated_path_env_var = match std::env::var("PATH") {
Ok(existing_path) => {
format!("{path_element}{PATH_SEPARATOR}{existing_path}")
format!("{existing_path}{PATH_SEPARATOR}{path_element}")
}
Err(_) => {
format!("{path_element}")
Expand Down