run_process_with_timeout

Function run_process_with_timeout 

Source
pub async fn run_process_with_timeout(
    tool_name: &str,
    cmd: Command,
    source: Option<&[u8]>,
    timeout_ms: Option<u64>,
    source_len: usize,
) -> DiagramResult<Output>
Expand description

Safely executes a child process, automatically managing timeouts, input piping, and memory cleanup.

§Arguments

  • tool_name - Human-readable name of the tool (e.g., “mmdc”, “dot”) for error messages.
  • cmd - The tokio Command to execute.
  • source - Optional bytes to pipe to stdin.
  • timeout_ms - Optional explicit timeout; falls back to adaptive_timeout.
  • source_len - Length of the source input (used for adaptive timeout and error context).