1
0
Fork 0
forked from AbleOS/ableos

run_program takes slice now

This commit is contained in:
Erin 2022-06-17 19:35:54 +02:00 committed by ondra05
parent ff703e5cb0
commit 00a7a884d8
2 changed files with 3 additions and 3 deletions

View file

@ -238,7 +238,7 @@ pub fn command_parser(user: String, command: String) {
let args = iter.collect::<Vec<&str>>(); let args = iter.collect::<Vec<&str>>();
println!("{:?}", args); println!("{:?}", args);
if in_home || in_shared || in_system { if in_home || in_shared || in_system {
run_program(binary_prog); run_program(&binary_prog);
} else { } else {
println!("No such binary: {}", bin_name); println!("No such binary: {}", bin_name);
error!("No such binary: {}", bin_name); error!("No such binary: {}", bin_name);

View file

@ -100,9 +100,9 @@ pub fn interp() {
} }
} }
pub fn run_program(program: Vec<u8>) { pub fn run_program(program: &[u8]) {
// Load wasm binary and prepare it for instantiation. // Load wasm binary and prepare it for instantiation.
let module = wasmi::Module::from_buffer(&program).expect("failed to load wasm"); let module = wasmi::Module::from_buffer(program).expect("failed to load wasm");
trace!("Loaded wasm binary"); trace!("Loaded wasm binary");
let imports = ImportsBuilder::new().with_resolver("env", &host_functions::HostExternals {}); let imports = ImportsBuilder::new().with_resolver("env", &host_functions::HostExternals {});