Skip to main content

ensure

Function ensure 

Source
pub fn ensure(
    engine: &Engine,
    cancel: &dyn Fn() -> bool,
    line: &mut dyn FnMut(&str),
) -> Result<Outcome, Failure>
Expand description

Makes sure BASE_IMAGE is on the machine and is the one described here, building it when it is not.

The build takes minutes and says what it is doing, so every line goes to line as it arrives and cancel stops it; an image that is already current costs one command and no output at all.

A build that fails or is stopped takes the name with it, half-made image and older image alike, which is build_image’s rule and the right one here: a profile image built on a half-made base would be missing pieces, and an older base left under the name would go on being rebuilt from at every profile.

Runs engine commands and waits for them, so it belongs on a background thread.

§Errors

When the build context cannot be written, or the engine cannot be started, refuses, or is stopped.