Use new WasiCtxBuilder types from wasi-common (#490)
* use new `WasiCtxBuilder` types from wasi-common * Update wasi-common deps
This commit is contained in:
committed by
Jakub Konka
parent
9e373d1b6b
commit
ab3cd945bc
@@ -25,7 +25,7 @@ wasmtime-obj = { path = "wasmtime-obj" }
|
|||||||
wasmtime-wast = { path = "wasmtime-wast" }
|
wasmtime-wast = { path = "wasmtime-wast" }
|
||||||
wasmtime-wasi = { path = "wasmtime-wasi" }
|
wasmtime-wasi = { path = "wasmtime-wasi" }
|
||||||
wasmtime-wasi-c = { path = "wasmtime-wasi-c", optional = true }
|
wasmtime-wasi-c = { path = "wasmtime-wasi-c", optional = true }
|
||||||
wasi-common = { git = "https://github.com/CraneStation/wasi-common", rev = "37ce4ba"}
|
wasi-common = { git = "https://github.com/CraneStation/wasi-common", rev = "2fe3530"}
|
||||||
docopt = "1.0.1"
|
docopt = "1.0.1"
|
||||||
serde = { "version" = "1.0.94", features = ["derive"] }
|
serde = { "version" = "1.0.94", features = ["derive"] }
|
||||||
faerie = "0.12.0"
|
faerie = "0.12.0"
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ core = ["hashbrown/nightly", "cranelift-codegen/core", "cranelift-wasm/core", "w
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
# for wasmtime.rs
|
# for wasmtime.rs
|
||||||
wasi-common = { git = "https://github.com/CraneStation/wasi-common", rev = "37ce4ba"}
|
wasi-common = { git = "https://github.com/CraneStation/wasi-common", rev = "2fe3530"}
|
||||||
docopt = "1.0.1"
|
docopt = "1.0.1"
|
||||||
serde = { "version" = "1.0.94", features = ["derive"] }
|
serde = { "version" = "1.0.94", features = ["derive"] }
|
||||||
pretty_env_logger = "0.3.0"
|
pretty_env_logger = "0.3.0"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ edition = "2018"
|
|||||||
wasmtime-runtime = { path = "../wasmtime-runtime" }
|
wasmtime-runtime = { path = "../wasmtime-runtime" }
|
||||||
wasmtime-environ = { path = "../wasmtime-environ" }
|
wasmtime-environ = { path = "../wasmtime-environ" }
|
||||||
wasmtime-jit = { path = "../wasmtime-jit" }
|
wasmtime-jit = { path = "../wasmtime-jit" }
|
||||||
wasi-common = { git = "https://github.com/CraneStation/wasi-common", rev = "37ce4ba"}
|
wasi-common = { git = "https://github.com/CraneStation/wasi-common", rev = "2fe3530"}
|
||||||
cranelift-codegen = { version = "0.49", features = ["enable-serde"] }
|
cranelift-codegen = { version = "0.49", features = ["enable-serde"] }
|
||||||
cranelift-entity = { version = "0.49", features = ["enable-serde"] }
|
cranelift-entity = { version = "0.49", features = ["enable-serde"] }
|
||||||
cranelift-wasm = { version = "0.49", features = ["enable-serde"] }
|
cranelift-wasm = { version = "0.49", features = ["enable-serde"] }
|
||||||
|
|||||||
@@ -102,12 +102,9 @@ pub fn instantiate_wasi(
|
|||||||
let signatures = PrimaryMap::new();
|
let signatures = PrimaryMap::new();
|
||||||
|
|
||||||
let mut wasi_ctx_builder = WasiCtxBuilder::new()
|
let mut wasi_ctx_builder = WasiCtxBuilder::new()
|
||||||
.and_then(|ctx| ctx.inherit_stdio())
|
.inherit_stdio()
|
||||||
.and_then(|ctx| ctx.args(argv.iter()))
|
.args(argv)
|
||||||
.and_then(|ctx| ctx.envs(environ.iter()))
|
.envs(environ);
|
||||||
.map_err(|err| {
|
|
||||||
InstantiationError::Resource(format!("couldn't assemble WASI context object: {}", err))
|
|
||||||
})?;
|
|
||||||
|
|
||||||
for (dir, f) in preopened_dirs {
|
for (dir, f) in preopened_dirs {
|
||||||
wasi_ctx_builder = wasi_ctx_builder.preopened_dir(
|
wasi_ctx_builder = wasi_ctx_builder.preopened_dir(
|
||||||
|
|||||||
Reference in New Issue
Block a user