wasmtime cli: use wasmtime_wasi's re-exports more deliberately

this drops the direct dep on wasi-cap-std-sync and wasi-common.
This commit is contained in:
Pat Hickey
2021-03-25 16:52:15 -07:00
parent 19a802549f
commit 183ee9d6d8
4 changed files with 3 additions and 9 deletions

2
Cargo.lock generated
View File

@@ -3285,8 +3285,6 @@ dependencies = [
"tempfile", "tempfile",
"test-programs", "test-programs",
"tracing-subscriber", "tracing-subscriber",
"wasi-cap-std-sync",
"wasi-common",
"wasmparser", "wasmparser",
"wasmtime", "wasmtime",
"wasmtime-cache", "wasmtime-cache",

View File

@@ -32,8 +32,6 @@ wasmtime-wast = { path = "crates/wast", version = "0.25.0" }
wasmtime-wasi = { path = "crates/wasi", version = "0.25.0" } wasmtime-wasi = { path = "crates/wasi", version = "0.25.0" }
wasmtime-wasi-crypto = { path = "crates/wasi-crypto", version = "0.25.0", optional = true } wasmtime-wasi-crypto = { path = "crates/wasi-crypto", version = "0.25.0", optional = true }
wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "0.25.0", optional = true } wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "0.25.0", optional = true }
wasi-common = { path = "crates/wasi-common", version = "0.25.0" }
wasi-cap-std-sync = { path = "crates/wasi-common/cap-std-sync", version = "0.25.0" }
structopt = { version = "0.3.5", features = ["color", "suggestions"] } structopt = { version = "0.3.5", features = ["color", "suggestions"] }
object = { version = "0.23.0", default-features = false, features = ["write"] } object = { version = "0.23.0", default-features = false, features = ["write"] }
anyhow = "1.0.19" anyhow = "1.0.19"

View File

@@ -11,11 +11,10 @@ use std::path::{Path, PathBuf};
use std::rc::Rc; use std::rc::Rc;
use std::slice; use std::slice;
use std::str; use std::str;
use wasi_cap_std_sync::WasiCtxBuilder;
use wasi_common::WasiCtx;
use wasmtime::{Extern, Linker, Trap}; use wasmtime::{Extern, Linker, Trap};
use wasmtime_wasi::{ use wasmtime_wasi::{
snapshots::preview_0::Wasi as WasiSnapshot0, snapshots::preview_1::Wasi as WasiPreview1, snapshots::preview_0::Wasi as WasiSnapshot0, snapshots::preview_1::Wasi as WasiPreview1,
sync::WasiCtxBuilder, WasiCtx,
}; };
unsafe fn cstr_to_path<'a>(path: *const c_char) -> Option<&'a Path> { unsafe fn cstr_to_path<'a>(path: *const c_char) -> Option<&'a Path> {
@@ -186,7 +185,7 @@ pub unsafe extern "C" fn wasi_config_preopen_dir(
}; };
let dir = match cstr_to_path(path) { let dir = match cstr_to_path(path) {
Some(p) => match cap_std::fs::Dir::open_ambient_dir(p) { Some(p) => match Dir::open_ambient_dir(p) {
Ok(d) => d, Ok(d) => d,
Err(_) => return false, Err(_) => return false,
}, },

View File

@@ -11,9 +11,8 @@ use std::{
process, process,
}; };
use structopt::{clap::AppSettings, StructOpt}; use structopt::{clap::AppSettings, StructOpt};
use wasi_cap_std_sync::WasiCtxBuilder;
use wasmtime::{Engine, Func, Linker, Module, Store, Trap, Val, ValType}; use wasmtime::{Engine, Func, Linker, Module, Store, Trap, Val, ValType};
use wasmtime_wasi::Wasi; use wasmtime_wasi::{sync::WasiCtxBuilder, Wasi};
#[cfg(feature = "wasi-nn")] #[cfg(feature = "wasi-nn")]
use wasmtime_wasi_nn::{WasiNn, WasiNnCtx}; use wasmtime_wasi_nn::{WasiNn, WasiNnCtx};