Implement the allow-unknown-exports option for the run command.
This commit implements the `--allow-unknown-exports` option to the CLI run command that will ignore unknown exports in a command module rather than return an error. Fixes #2587.
This commit is contained in:
@@ -162,6 +162,24 @@ fn module_interposition() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn allow_unknown_exports() -> Result<()> {
|
||||
let store = Store::default();
|
||||
let mut linker = Linker::new(&store);
|
||||
let module = Module::new(
|
||||
store.engine(),
|
||||
r#"(module (func (export "_start")) (global (export "g") i32 (i32.const 0)))"#,
|
||||
)?;
|
||||
|
||||
assert!(linker.module("module", &module).is_err());
|
||||
|
||||
let mut linker = Linker::new(&store);
|
||||
linker.allow_unknown_exports(true);
|
||||
linker.module("module", &module)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_leak() -> Result<()> {
|
||||
struct DropMe(Rc<Cell<bool>>);
|
||||
|
||||
Reference in New Issue
Block a user