Macro spawn_script

Source
macro_rules! spawn_script {
    ($script:expr) => { ... };
    ($script:expr, $options:expr) => { ... };
}
Expand description

Spawn an OpenScript process with optional configuration.

This macro provides a convenient way to spawn OpenScript processes without waiting for completion.

ยงExamples

use openrunner_rs::{spawn_script, ScriptOptions};

// Spawn with default options. This assumes `openscript` is in the PATH.
// let child = spawn_script!("echo 'Background task'").await?;

// Spawn with custom options (shell for testing)
let options = ScriptOptions::new().openscript_path("/bin/sh");
let spawn_result = spawn_script!("echo 'Background task'", options).await?;

// Spawn with additional configuration
let options = ScriptOptions::new()
    .openscript_path("/bin/sh")
    .env("DEBUG", "1");
let spawn_result_2 = spawn_script!("echo 'Background task'", options).await?;

// Wait for completion
let output = spawn_result.child.wait_with_output().await?;