Skip to content

Commit

Permalink
Update from feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark McCaskey committed Apr 27, 2021
1 parent bc9706e commit 1e9603e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions lib/cli/src/commands/run/wasi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct Wasi {
#[clap(long = "dir", name = "DIR", multiple = true, group = "wasi")]
pre_opened_directories: Vec<PathBuf>,

/// Map a host directory to a different location for the wasm module
/// Map a host directory to a different location for the Wasm module
#[clap(long = "mapdir", name = "GUEST_DIR:HOST_DIR", multiple = true, parse(try_from_str = parse_mapdir))]
mapped_dirs: Vec<(String, PathBuf)>,

Expand All @@ -27,9 +27,11 @@ pub struct Wasi {
#[clap(long = "enable-experimental-io-devices")]
enable_experimental_io_devices: bool,

/// Allow WASI modules to import multiple versions of WASI without a warning.
#[clap(long = "allow-multiple-wasi-versions")]
pub allow_multiple_wasi_versions: bool,

/// Require WASI modules to only import 1 version of WASI.
#[clap(long = "deny-multiple-wasi-versions")]
pub deny_multiple_wasi_versions: bool,
}
Expand Down Expand Up @@ -70,8 +72,7 @@ impl Wasi {
}

let mut wasi_env = wasi_state_builder.finalize()?;
//let import_object = wasi_env.import_object(&module)?;
let resolver = wasi_env.multiple_wasi_resolver(&module)?;
let resolver = wasi_env.import_object_for_all_wasi_versions(&module)?;
let instance = Instance::new(&module, &resolver)?;

let start = instance.exports.get_function("_start")?;
Expand Down
2 changes: 1 addition & 1 deletion lib/wasi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl WasiEnv {

/// Like `import_object` but containing all the WASI versions detected in
/// the module.
pub fn multiple_wasi_resolver(
pub fn import_object_for_all_wasi_versions(
&mut self,
module: &Module,
) -> Result<Box<dyn NamedResolver>, WasiError> {
Expand Down
2 changes: 1 addition & 1 deletion lib/wasi/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const SNAPSHOT1_NAMESPACE: &str = "wasi_snapshot_preview1";
///
/// A strict detection expects that all imports live in a single WASI
/// namespace. A non-strict detection expects that at least one WASI
/// namespace exits to detect the version. Note that the strict
/// namespace exists to detect the version. Note that the strict
/// detection is faster than the non-strict one.
pub fn get_wasi_version(module: &Module, strict: bool) -> Option<WasiVersion> {
let mut imports = module.imports().functions().map(|f| f.module().to_owned());
Expand Down

0 comments on commit 1e9603e

Please sign in to comment.