Skip to content

Commit

Permalink
Actually mount when mapping into /
Browse files Browse the repository at this point in the history
  • Loading branch information
theduke committed May 31, 2023
1 parent 2b1fa2f commit eec73b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/virtual-fs/src/tmp_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ impl TmpFileSystem {
self.fs.union(other)
}

/// See [`mem_fs::FileSystem::mount_directory_entries`].
pub fn mount_directory_entries(
&self,
target_path: &Path,
other: &Arc<dyn crate::FileSystem + Send + Sync>,
source_path: &Path,
) -> Result<()> {
self.fs
.mount_directory_entries(target_path, other, source_path)
}

pub fn mount(
&self,
src_path: PathBuf,
Expand Down
1 change: 1 addition & 0 deletions lib/wasi/src/runners/wasi_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ fn prepare_filesystem(
})?;

if guest_path == Path::new("/") {
root_fs.mount_directory_entries(&guest_path, &host_fs, &host_path)?;
} else {
if let Some(parent) = guest_path.parent() {
create_dir_all(&root_fs, parent).with_context(|| {
Expand Down

0 comments on commit eec73b7

Please sign in to comment.