diff --git a/src/ctx.rs b/src/ctx.rs index 434dcedf2c..c56ee1f6ea 100644 --- a/src/ctx.rs +++ b/src/ctx.rs @@ -11,7 +11,7 @@ use std::path::{Path, PathBuf}; /// A builder allowing customizable construction of `WasiCtx` instances. pub struct WasiCtxBuilder { fds: HashMap, - preopens: HashMap, + preopens: Vec<(PathBuf, File)>, args: Vec, env: HashMap, } @@ -21,7 +21,7 @@ impl WasiCtxBuilder { pub fn new() -> Result { let mut builder = Self { fds: HashMap::new(), - preopens: HashMap::new(), + preopens: Vec::new(), args: vec![], env: HashMap::new(), }; @@ -98,7 +98,7 @@ impl WasiCtxBuilder { /// Add a preopened directory. pub fn preopened_dir>(mut self, dir: File, guest_path: P) -> Self { - self.preopens.insert(guest_path.as_ref().to_owned(), dir); + self.preopens.push((guest_path.as_ref().to_owned(), dir)); self }