Skip to content
This repository has been archived by the owner on Aug 24, 2023. It is now read-only.

open file error #16

Closed
anthhub opened this issue Nov 6, 2020 · 2 comments
Closed

open file error #16

anthhub opened this issue Nov 6, 2020 · 2 comments

Comments

@anthhub
Copy link

anthhub commented Nov 6, 2020

Following rust code will throw error, it look like this issue wasmerio/wasmer#356

   let mut input: Box<dyn std::io::Read> = match File::open(path) {
        Ok(f) => Box::new(f),
        Err(e) => {
            let mut estr = String::from(path);
            estr.push_str(": ");
            estr.push_str(&e.to_string());
            return Err(estr);
        }
    };
 failed to find a pre-opened file descriptor through which "/workspaces/ssvm-nodejs-starter/2020-10-19-11-50-19.json" could be opened
@juntao
Copy link
Member

juntao commented Nov 6, 2020

To access file system through WASI, please follow this tutorial.

https://www.secondstate.io/articles/wasi-access-system-resources/

The issue here is that Rust compiler has not been updated to support WASI file system calls. So, you must add a manual workaround in Rust and wait for the official compiler release to catch up.

@anthhub
Copy link
Author

anthhub commented Nov 9, 2020

Thank you! it works!

@anthhub anthhub closed this as completed Nov 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants