Skip to main content

spawn_monitor

Function spawn_monitor 

Source
pub fn spawn_monitor(
    state: &State,
    program: &str,
    args: &[String],
    envs: &[(String, String)],
) -> Result<u32, MonitorError>
Expand description

Spawn a background monitor that owns the agent for the given workflow state.

The monitor is a detached shell process that:

  1. Launches the agent (program + args) with stdout redirected to the phase stdout file, recording the agent PID to the agent-pid file
  2. Waits for the agent to exit and records its exit code to the exit file
  3. Runs devflow advance --phase N to advance the workflow through its remaining stages

Returns the PID of the spawned monitor.