MCPcopy Create free account
hub / github.com/aiscriptdev/aiscript / run_file

Method run_file

aiscript-vm/src/vm/mod.rs:65–82  ·  view source on GitHub ↗
(&mut self, path: PathBuf)

Source from the content-addressed store, hash-verified

63 }
64
65 pub fn run_file(&mut self, path: PathBuf) {
66 match fs::read_to_string(&path) {
67 Ok(source) => {
68 let source: &'static str = Box::leak(source.into_boxed_str());
69 if let Err(VmError::CompileError) = self.compile(source) {
70 std::process::exit(65);
71 }
72 if let Err(VmError::RuntimeError(err)) = self.interpret() {
73 eprintln!("{err}");
74 std::process::exit(70);
75 }
76 }
77 Err(err) => {
78 eprintln!("Failed to read file '{}': {}", path.display(), err);
79 std::process::exit(1);
80 }
81 }
82 }
83
84 fn init_stdlib(&mut self) {
85 self.arena.mutate_root(|_mc, state| {

Callers 1

mainFunction · 0.80

Calls 2

compileMethod · 0.80
interpretMethod · 0.80

Tested by

no test coverage detected