Skip to main content

run_program

Function run_program 

Source
pub fn run_program(src: &str, input: &str) -> Result<String, String>
Expand description

Run src as a complete program with input as its stdin and return everything it wrote to stdout.

src is spec text, as arb -e SRC takes it. Each call builds the spec from scratch on a fresh thread, so nothing carries over between calls and concurrent calls write to their own buffers. A run that ends with a nonzero status (a spec error, a jq error, halt_error, a panic) returns Err with what arb wrote to stderr, or exit status N when it wrote nothing; a run that ends with status 0, including jq’s halt, returns Ok with the output produced so far.