Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ impl Runtime {

/// Make all mounted files visible to the WASI virtual filesystem
fn add_files(&mut self, runner: dynamic::DynamicRunner) -> anyhow::Result<()> {
//TODO(rylev): handle component.exclude_files
/// Make a file visible to the WASI virtual filesystem
fn add_file<T>(
store: &mut wasmtime::Store<T>,
Expand All @@ -114,8 +113,19 @@ impl Runtime {
format!("failed to read glob entry for pattern '{p}'")
})?;

// If the file among list of files to be excluded, skip it
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

host_path is an absolute path but I think the paths in exclude_files are relative to the manifest. Have you run this code to see if it works? I don't think we have tests for the runtime, but it would be really nice if we did.

Copy link
Author

@seun-ja seun-ja Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't run it because I keep running into the type mismatch error.

Looking at the sample provided for what an exclude_files can be like it looks to be in form of relative path. I would used relative path instead.

if self
.manifest
.component()
.exclude_files
.contains(&host_path.display().to_string())
{
continue;
}

// Host path is the absolute path to the file
let host_path = self.manifest.absolute_from(host_path);

// Only add files
if !host_path.is_file() {
continue;
Expand All @@ -139,6 +149,12 @@ impl Runtime {
.strip_prefix('/')
.unwrap_or(destination.as_str())
);

// If the file among list of files to be excluded, skip it
if self.manifest.component().exclude_files.contains(source) {
continue;
}

let host_path = self.manifest.absolute_from(source);

// If the host path is a directory, add all files in the directory
Expand Down