Skip to main content

spawn

Function spawn 

Source
pub fn spawn(program: &str, args: &[&str], cwd: Option<&str>) -> Result<Child>
Expand description

Spawns program with args: no stdin, output to the daemon’s log.

Examples found in repository?
examples/together_companion.rs (line 44)
42async fn rebuild(cx: Context, builds: Rc<Cell<u32>>, running: Rc<Cell<bool>>) {
43    publish(&cx, "building", builds.get());
44    let passed = process::spawn("make", &[], None)
45        .and_then(|child| child.wait())
46        .is_ok_and(|status| status == 0);
47    builds.set(builds.get() + 1);
48    running.set(false);
49    publish(&cx, if passed { "passed" } else { "failed" }, builds.get());
50}