Skip to content

preopen current dir #5150

Open
Open
@giteewif

Description

@giteewif

Summary

could not preopen dir in host

Additional details

Code using wasmer 4.4.0

    let mut wasienv = WasiEnv::builder("hello")
        .stdout(Box::new(stdout_tx))
        .map_dir(".", current_dir)?;
    wasienv.run_with_store(module, &mut store)?;

when execute, there is a error like this

error: Init(WasiFsCreationError("Could not get metadata for file \" file_name\"": entry not found  

I guess that the problem is related to the host_fs,so i add hostfs in code, and it work, it seems that default hostfs of wasmer-wasix not work?

    let runtime = tokio::runtime::Runtime::new().unwrap();
    let guard =runtime.enter();

    let wasienv = WasiEnv::builder("hello")
        .fs( Box::new(virtual_fs::host_fs::FileSystem::new(Handle::current(), "/").unwrap()))
        .stdout(Box::new(stdout_tx))
        .map_dir(".", current_dir)?;

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions