mirror of
https://github.com/openai/codex.git
synced 2026-10-19 17:28:46 +00:00
Avoid redundant filesystem probes (#36393)
## What changed - Load `environments.toml` in one operation, falling back to the default environment provider only when the read reports that the file is missing. - Attempt the default daemon socket connection directly instead of checking the socket path first. - Preserve each file search entry's type from the directory walker, avoiding a second metadata lookup when producing matches and correctly classifying followed directory symlinks. - Write atomic-file contents through the existing temporary-file handle rather than reopening its path. ## Testing - Add Unix coverage for classifying a followed directory symlink as a directory in file search results. GitOrigin-RevId: aa6739cac23953ca8b9a3fcb53e43e72c41cfdf9
This commit is contained in:
@@ -6,6 +6,7 @@ pub use env::is_wsl;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use std::collections::HashSet;
|
||||
use std::io;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use tempfile::NamedTempFile;
|
||||
@@ -126,8 +127,8 @@ pub fn write_atomically(write_path: &Path, contents: &str) -> io::Result<()> {
|
||||
)
|
||||
})?;
|
||||
std::fs::create_dir_all(parent)?;
|
||||
let tmp = NamedTempFile::new_in(parent)?;
|
||||
std::fs::write(tmp.path(), contents)?;
|
||||
let mut tmp = NamedTempFile::new_in(parent)?;
|
||||
tmp.write_all(contents.as_bytes())?;
|
||||
tmp.persist(write_path)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user