From b706fad1b63b638964bbfaf882502d323bd54488 Mon Sep 17 00:00:00 2001 From: David Wiesen Date: Tue, 7 Oct 2025 15:07:31 -0700 Subject: [PATCH] more build fixes. --- codex-rs/core/Cargo.toml | 3 +++ codex-rs/core/src/lib.rs | 2 +- codex-rs/core/src/windows_appcontainer.rs | 30 +++++++++++++++++++-- codex-rs/core/tests/windows_appcontainer.rs | 6 ++++- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/codex-rs/core/Cargo.toml b/codex-rs/core/Cargo.toml index a895d4f563..fc57a6131e 100644 --- a/codex-rs/core/Cargo.toml +++ b/codex-rs/core/Cargo.toml @@ -93,6 +93,9 @@ windows = { version = "0.58", features = [ [features] default = [] windows_appcontainer_command_ext = [] +windows_appcontainer_command_ext_raw_attribute = [ + "windows_appcontainer_command_ext", +] # Build OpenSSL from source for musl builds. [target.x86_64-unknown-linux-musl.dependencies] diff --git a/codex-rs/core/src/lib.rs b/codex-rs/core/src/lib.rs index ec8d66f6e2..e91e2e4732 100644 --- a/codex-rs/core/src/lib.rs +++ b/codex-rs/core/src/lib.rs @@ -1,7 +1,7 @@ //! Root of the `codex-core` library. #![cfg_attr( - all(windows, feature = "windows_appcontainer_command_ext"), + all(windows, feature = "windows_appcontainer_command_ext_raw_attribute"), feature(windows_process_extensions_raw_attribute) )] // Prevent accidental direct writes to stdout/stderr in library code. All diff --git a/codex-rs/core/src/windows_appcontainer.rs b/codex-rs/core/src/windows_appcontainer.rs index 737135019e..3a02295fbd 100644 --- a/codex-rs/core/src/windows_appcontainer.rs +++ b/codex-rs/core/src/windows_appcontainer.rs @@ -8,7 +8,11 @@ use tracing::trace; use crate::protocol::SandboxPolicy; use crate::spawn::StdioPolicy; -#[cfg(feature = "windows_appcontainer_command_ext")] + +#[cfg(all( + feature = "windows_appcontainer_command_ext", + feature = "windows_appcontainer_command_ext_raw_attribute", +))] mod imp { use super::*; @@ -444,9 +448,31 @@ mod imp { } } -#[cfg(feature = "windows_appcontainer_command_ext")] +#[cfg(all( + feature = "windows_appcontainer_command_ext", + feature = "windows_appcontainer_command_ext_raw_attribute", +))] pub use imp::spawn_command_under_windows_appcontainer; +#[cfg(all( + feature = "windows_appcontainer_command_ext", + not(feature = "windows_appcontainer_command_ext_raw_attribute"), +))] +pub async fn spawn_command_under_windows_appcontainer( + command: Vec, + command_cwd: PathBuf, + _sandbox_policy: &SandboxPolicy, + _sandbox_policy_cwd: &Path, + _stdio_policy: StdioPolicy, + _env: HashMap, +) -> io::Result { + let _ = (command, command_cwd); + Err(io::Error::new( + io::ErrorKind::Unsupported, + "AppContainer sandboxing requires the `windows_appcontainer_command_ext_raw_attribute` feature, which in turn needs a nightly compiler", + )) +} + #[cfg(not(feature = "windows_appcontainer_command_ext"))] pub async fn spawn_command_under_windows_appcontainer( command: Vec, diff --git a/codex-rs/core/tests/windows_appcontainer.rs b/codex-rs/core/tests/windows_appcontainer.rs index b90216acec..e8d5196f03 100644 --- a/codex-rs/core/tests/windows_appcontainer.rs +++ b/codex-rs/core/tests/windows_appcontainer.rs @@ -1,4 +1,8 @@ -#![cfg(all(windows, feature = "windows_appcontainer_command_ext"))] +#![cfg(all( + windows, + feature = "windows_appcontainer_command_ext", + feature = "windows_appcontainer_command_ext_raw_attribute", +))] use codex_core::protocol::SandboxPolicy; use codex_core::spawn::StdioPolicy;