diff --git a/src/interpreter.rs b/src/interpreter.rs index 2dc8060..926aaf7 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -262,6 +262,8 @@ pub fn run_file(path: &str) -> Result<(), Box> { pub fn run_prompt() -> Result<(), Box> { let stdin = io::stdin(); let mut handle = stdin.lock(); + let mut stdout = std::io::stdout(); + let mut interpreter = Interpreter::new(&mut stdout); loop { print!("> "); io::stdout().flush()?; @@ -270,7 +272,7 @@ pub fn run_prompt() -> Result<(), Box> { if r == 0 { return Ok(()); } - let result = run(&buffer); + let result = run_with_interpreter(&buffer, &mut interpreter); match result { Err(errors) => { for error in errors {