MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / handoff_codex_lifecycle

Method handoff_codex_lifecycle

atomic-cli/src/commands/agent/hooks.rs:346–382  ·  view source on GitHub ↗
(&self, input: &[u8])

Source from the content-addressed store, hash-verified

344 }
345
346 fn handoff_codex_lifecycle(&self, input: &[u8]) -> CliResult<()> {
347 let exe = std::env::current_exe().map_err(|e| {
348 CliError::Internal(anyhow!("Failed to resolve atomic executable: {}", e))
349 })?;
350
351 let mut child = ProcessCommand::new(exe)
352 .arg("agent")
353 .arg("hooks")
354 .arg(&self.agent_name)
355 .arg(&self.verb)
356 .arg("--foreground")
357 .stdin(Stdio::piped())
358 .stdout(Stdio::null())
359 .stderr(Stdio::null())
360 .spawn()
361 .map_err(|e| {
362 CliError::Internal(anyhow!(
363 "Failed to start background Codex {} worker: {}",
364 self.verb,
365 e,
366 ))
367 })?;
368
369 if let Some(mut stdin) = child.stdin.take() {
370 stdin.write_all(input).map_err(|e| {
371 CliError::Io(std::io::Error::new(
372 e.kind(),
373 format!(
374 "Failed to pass Codex {} input to background worker: {}",
375 self.verb, e,
376 ),
377 ))
378 })?;
379 }
380
381 Ok(())
382 }
383}
384
385// Tests

Callers 1

runMethod · 0.80

Calls 1

kindMethod · 0.45

Tested by

no test coverage detected