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.

Each call runs on its own thread, so it gets a fresh host, its own output capture and its own stdin (all thread-local), and never touches the process stdout. input is what readLines("stdin") reads. Output is the Rscript transcript: top-level autoprint, print, cat. A parse, compile or runtime error (including stop()) is Err with its message; a panic in the runtime is caught at the thread boundary and also becomes Err. Warnings still go to the process stderr.