job_await
host callCapy
function job_await(job : dval, timeout_ms : s32) dval
Description
job_await() waits for a job until the timeout expires. It returns the current status when the timeout expires.
Parameters
job : a job ID as dval
timeout_ms : maximum wait time in milliseconds
Return Values
A job status map. A completed job includes result.
Example
Capy
var job := shell_exec("printf hello", {background: true, timeout_ms: 1000})
var result := job_await(job, 3000)
print(get_by_path(result, "result/stdout"), "\n")