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:
Peter Huene
2021-05-06 14:19:14 -07:00
parent 6a1a169c62
commit 91f64d40d4
3 changed files with 53 additions and 1 deletions

View File

@@ -81,6 +81,10 @@ pub struct RunCommand {
#[structopt(flatten)]
common: CommonOptions,
/// Allow unknown exports when running commands.
#[structopt(long = "allow-unknown-exports")]
allow_unknown_exports: bool,
/// Grant access to the given host directory
#[structopt(long = "dir", number_of_values = 1, value_name = "DIRECTORY")]
dirs: Vec<String>,
@@ -146,6 +150,8 @@ impl RunCommand {
let argv = self.compute_argv();
let mut linker = Linker::new(&store);
linker.allow_unknown_exports(self.allow_unknown_exports);
populate_with_wasi(
&mut linker,
preopen_dirs,