Function scoped_task::spawn

source ·
pub fn spawn<'a>(
    job: impl Borrow<&'a Scoped<Job>>,
    options: SpawnOptions,
    path: &CStr,
    argv: &[&CStr]
) -> Result<Scoped<Process>, Status>
Expand description

A convenience wrapper around fdio::spawn that returns a Scoped.

Note that you must assign the return value to a local. You can use a leading underscore in the name to avoid the unused variable lint, but don’t use just _ or the process will be killed immediately. For example,

let _process = scoped_task::spawn(
    &[c"hello world"],
).expect("could not spawn process");