uce/site/doc/pages/job_await.txt
2026-06-16 23:02:45 +00:00

14 lines
472 B
Plaintext

# job_await
Waits up to `timeout_ms` for a job to finish, then returns status/result data. The wait is always bounded and returns with `state=running` if the job is still active.
:see
>sys
:example
DValue spec; spec["cmd"] = "printf hello-from-job"; spec["timeout_ms"] = (f64)1000;
u64 job = shell_spawn(spec);
DValue waited = job_await(job, 3000);
print("done=", waited["done"].to_bool() ? "true" : "false", " stdout=", waited["result"]["stdout"].to_string(), "\n");