Skip to main content

Module run

Module run 

Source
Expand description

Running the commands an Engine spells out.

Two ways of running, because QCode asks two kinds of question. Most commands answer at once and their answer is read whole (capture). Building an image does not: it talks for minutes, the person watches it in a log and may change their mind, so stream hands over every line as it arrives and stops when asked (build_image then clears the half-made image away).

Neither of them is a place to wait: the caller runs them inside a qframe Task, whose thread they already have, whose is_cancelled is the cancel they are given and whose send carries the lines to the log.

Structs§

Failure
A command that ran and failed. It carries what was run and everything the engine said, so the person can be shown the engine’s own words rather than a summary of them.

Enums§

EngineError
Why a command did not do what was asked.

Functions§

build_image
Builds an image, showing the build as it happens and leaving nothing behind when it is cancelled or fails.
capture
Runs command to the end and returns what it printed to standard output.
feed
Runs command, writes input to its standard input and closes it, and returns what it printed to standard output, the way capture does, deadline and all.
pipe
Runs from and to side by side with what from prints going straight into to, the way a shell’s | does: the bytes pass from one process to the other and never through QCode, so a home of any size is copied in the memory of a pipe.
speak_with
Gives the engine layer the person’s translator for the sentence of timed_out, which is mostly made on a background thread: the runtime lends its translator only to the screen’s own work. words is asked each time, so a language changed since the start is the one used. Without it the sentence is English.
stream
Runs command, handing every line to line as it arrives, and stops it as soon as cancel says so.
timed_out
The sentence the person reads when an engine did not answer in time: which engine, how long it was given, and what is most likely wrong, in their language.