Move preopen_dir handlers from wasmtime to wasi-common

This commit is contained in:
Jakub Konka
2019-06-04 08:02:01 +02:00
committed by Dan Gohman
parent 9a66400cd8
commit c113ff32e6
3 changed files with 29 additions and 2 deletions

View File

@@ -2,6 +2,14 @@ pub mod fdentry;
mod host_impl;
pub mod hostcalls;
pub fn dev_null() -> std::fs::File {
std::fs::File::open("/dev/null").expect("failed to open /dev/null")
use std::fs::File;
use std::io;
use std::path::Path;
pub fn dev_null() -> File {
File::open("/dev/null").expect("failed to open /dev/null")
}
pub fn preopen_dir<P: AsRef<Path>>(path: P) -> io::Result<File> {
File::open(path)
}