Skip to main content

execute

Function execute 

Source
pub async fn execute(program: &Program, env: ShellEnv) -> ShellResult
Expand description

Walks program to completion, returning its exit code. An empty program exits 0.

Returning is what ends the run, and it is the only thing that does. A cancelled pipeline can leave a stage detached (a builtin stage runs on a detached thread, which is not waited on by the runtime), and such a stage still holds a clone of env.output: the channel therefore stays open past this point, for as long as that stage lives. A caller must forward lines while this future runs and stop once it resolves, draining whatever is already queued. Treating “the channel closed” as “the run finished” would wait out exactly the stage cancellation exists to stop waiting for.