Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

nit: get rid of an expect (#18144)

jif-oai895e2d056f53
diff --git a/codex-rs/protocol/src/protocol.rs b/codex-rs/protocol/src/protocol.rs
index ca113536e0..fb1ea592da 100644
--- a/codex-rs/protocol/src/protocol.rs
+++ b/codex-rs/protocol/src/protocol.rs
@@ -1223,11 +1223,15 @@ impl SandboxPolicy {
// Include /tmp on Unix unless explicitly excluded.
if cfg!(unix) && !exclude_slash_tmp {
- #[allow(clippy::expect_used)]
- let slash_tmp =
- AbsolutePathBuf::from_absolute_path("/tmp").expect("/tmp is absolute");
- if slash_tmp.as_path().is_dir() {
- roots.push(slash_tmp);
+ match AbsolutePathBuf::from_absolute_path("/tmp") {
+ Ok(slash_tmp) => {
+ if slash_tmp.as_path().is_dir() {
+ roots.push(slash_tmp);
+ }
+ }
+ Err(e) => {
+ error!("Ignoring invalid /tmp for sandbox writable root: {e}");
+ }
}
}