pub struct CodexExec { /* private fields */ }Expand description
Process runner for the Codex CLI.
Implementations§
Source§impl CodexExec
impl CodexExec
Sourcepub fn new(
executable_path_override: Option<String>,
env_override: Option<HashMap<String, String>>,
config_overrides: Option<CodexConfigObject>,
) -> Result<Self>
pub fn new( executable_path_override: Option<String>, env_override: Option<HashMap<String, String>>, config_overrides: Option<CodexConfigObject>, ) -> Result<Self>
Creates a Codex subprocess runner.
When executable_path_override is not supplied, the executable is
discovered from standard local and global install locations.
§Example
use codex::CodexExec;
let _exec = CodexExec::new(None, None, None)?;Sourcepub async fn run(
&self,
args: CodexExecArgs,
) -> Result<BoxStream<'static, Result<String>>>
pub async fn run( &self, args: CodexExecArgs, ) -> Result<BoxStream<'static, Result<String>>>
Runs one codex exec --experimental-json invocation and returns a stream
of stdout JSONL lines.
The returned stream yields lines as they arrive and finishes only after
the subprocess exits successfully. Non-zero exit status is returned as
Error::Process.
§Example
use codex::{CodexExec, CodexExecArgs};
use futures::StreamExt;
let exec = CodexExec::new(None, None, None)?;
let mut stream = exec
.run(CodexExecArgs {
input: "Say hello".to_string(),
..Default::default()
})
.await?;
let _first = stream.next().await;Trait Implementations§
Auto Trait Implementations§
impl Freeze for CodexExec
impl RefUnwindSafe for CodexExec
impl Send for CodexExec
impl Sync for CodexExec
impl Unpin for CodexExec
impl UnsafeUnpin for CodexExec
impl UnwindSafe for CodexExec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more