* fix Linux `isatty` implementation * defer `WasiCtxBuilder` errors to `build()`; don't change API yet This changes the fields on the builder to types that let the various `.arg()`, `.env()`, etc methods infallible, so we don't have to worry about handling any errors till we actually build. This reduces line noise when using a builder in a downstream application. Deferring the processing of the builder fields also has the advantage of eliminating the opening and closing of `/dev/null` for the default stdio file descriptors unless they're actually used by the resulting `WasiCtx`. Unicode errors when inheriting arguments and environment variables no longer cause a panic, but instead go through `OsString`. We return `ENOTCAPABLE` at the end if there are NULs, or if UTF-8 conversion fails on Windows. This also changes the bounds on some of the methods from `AsRef<str>` to `AsRef<[u8]>`. This shouldn't break any existing code, but allows more flexibility when providing arguments. Depending on the outcome of https://github.com/WebAssembly/WASI/issues/8 we may eventually want to require these bytes be UTF-8, so we might want to revisit this later. Finally, this fixes a tiny bug that could arise if we had exactly the maximum number of file descriptors when populating the preopens. * make `WasiCtxBuilder` method types less restrictive This is a separate commit, since it changes the interface that downstream clients have to use, and therefore requires a different commit of `wasmtime` for testing. That `wasmtime` commit is currently on my private fork, so this will need to be amended before merging. Now that failures are deferred until `WasiCtxBuilder::build()`, we don't need to have `Result` types on the other methods any longer. Additionally, using `IntoIterator` rather than `Iterator` as the trait bound for these methods is slightly more general, and saves the client some typing. * enforce that arguments and environment variables are valid UTF-8 * remove now-unnecessary platform-specific OsString handling * `ENOTCAPABLE` -> `EILSEQ` for failed arg/env string conversions * fix up comment style * Apply @acfoltzer's fix to isatty on Linux to BSD
70 lines
2.0 KiB
TOML
70 lines
2.0 KiB
TOML
[package]
|
|
name = "wasi-common"
|
|
version = "0.5.0"
|
|
authors = [
|
|
"Adam C. Foltzer <acfoltzer@fastly.com>",
|
|
"Frank Denis <github@pureftpd.org>",
|
|
"Jakub Konka <kubkon@jakubkonka.com>",
|
|
"Dan Gohman <sunfish@mozilla.com>"]
|
|
edition = "2018"
|
|
license = "Apache-2.0 WITH LLVM-exception"
|
|
description = "WASI implementation in Rust"
|
|
categories = ["wasm"]
|
|
keywords = ["webassembly", "wasm"]
|
|
repository = "https://github.com/CraneStation/wasi-common"
|
|
readme = "README.md"
|
|
|
|
[features]
|
|
# this feature requires wasm32-wasi target installed, and it enables wasm32
|
|
# integration tests when run with `cargo test --features wasm_tests`
|
|
wasm_tests = []
|
|
|
|
[dependencies]
|
|
wasi-common-cbindgen = { path = "wasi-common-cbindgen", version = "0.5.0" }
|
|
failure = "0.1"
|
|
libc = "0.2"
|
|
rand = "0.7"
|
|
cfg-if = "0.1.9"
|
|
log = "0.4"
|
|
filetime = "0.2.7"
|
|
lazy_static = "1.4.0"
|
|
num = { version = "0.2.0", default-features = false }
|
|
wig = { path = "wig", version = "0.1.0" }
|
|
|
|
[target.'cfg(unix)'.dependencies]
|
|
nix = "0.15"
|
|
|
|
[target.'cfg(windows)'.dependencies]
|
|
winx = { path = "winx", version = "0.5.0" }
|
|
winapi = "0.3"
|
|
cpu-time = "1.0"
|
|
|
|
|
|
[dev-dependencies]
|
|
wasmtime-runtime = { git = "https://github.com/acfoltzer/wasmtime", rev = "d99e2fb" }
|
|
wasmtime-environ = { git = "https://github.com/acfoltzer/wasmtime", rev = "d99e2fb" }
|
|
wasmtime-jit = { git = "https://github.com/acfoltzer/wasmtime", rev = "d99e2fb" }
|
|
wasmtime-wasi = { git = "https://github.com/acfoltzer/wasmtime", rev = "d99e2fb" }
|
|
wasmtime-api = { git = "https://github.com/acfoltzer/wasmtime", rev = "d99e2fb" }
|
|
cranelift-codegen = "0.47.0"
|
|
target-lexicon = "0.8.1"
|
|
pretty_env_logger = "0.3.0"
|
|
tempfile = "3.1.0"
|
|
# this is just a temp fix to make the tests build and run; I hope this to be
|
|
# completely removed when we merge `wasi-common` into `wasmtime`
|
|
faerie = "=0.11.0"
|
|
|
|
[patch."https://github.com/CraneStation/wasi-common"]
|
|
wasi-common = { path = "." }
|
|
|
|
[build-dependencies]
|
|
cfg-if = "0.1.9"
|
|
|
|
[lib]
|
|
name = "wasi_common"
|
|
crate-type = ["rlib", "staticlib", "cdylib"]
|
|
|
|
[workspace]
|
|
members = ["wasi-common-cbindgen"]
|
|
exclude = ["winx", "misc_testsuite"]
|