fix(tvix/eval): print code even if runtime fails

Change-Id: I357c9adf939cb6001afa73ad02282d94ee22d0ba
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6088
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2022-08-09 16:51:37 +03:00 committed by tazjin
parent 2ed38a7cdb
commit 865717a8db

View file

@ -1,5 +1,4 @@
use rnix::{self, types::TypedNode};
use std::fmt::Write;
use crate::errors::EvalResult;
@ -11,14 +10,11 @@ pub fn interpret(code: String) -> EvalResult<String> {
todo!()
}
let mut out = String::new();
println!("{}", ast.root().dump());
let code = crate::compiler::compile(ast)?;
writeln!(out, "code: {:?}", code).ok();
println!("code: {:?}", code);
let value = crate::vm::run_chunk(code)?;
writeln!(out, "value: {:?}", value).ok();
Ok(out)
Ok(format!("value: {:?}", value))
}