Use is-terminal instead of atty.
Following up on #3696, use the new is-terminal crate to test for a tty rather than having platform-specific logic in Wasmtime. The is-terminal crate has a platform-independent API which takes a handle. This also updates the tree to cap-std 0.24 etc., to avoid depending on multiple versions of io-lifetimes at once, as enforced by the cargo deny check.
This commit is contained in:
@@ -22,7 +22,7 @@ wasmtime-wasi = { path = "../wasi" }
|
||||
wasmtime-wasi-crypto = { path = "../wasi-crypto", optional = true }
|
||||
wasmtime-wasi-nn = { path = "../wasi-nn", optional = true }
|
||||
wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync" }
|
||||
cap-std = "0.22.0"
|
||||
cap-std = "0.24.0"
|
||||
|
||||
[dev-dependencies]
|
||||
wat = "1.0"
|
||||
|
||||
@@ -29,7 +29,7 @@ wat = { version = "1.0.36", optional = true }
|
||||
# Optional dependencies for the `wasi` feature
|
||||
wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync", optional = true }
|
||||
wasmtime-wasi = { path = "../wasi", optional = true }
|
||||
cap-std = { version = "0.22.0", optional = true }
|
||||
cap-std = { version = "0.24.0", optional = true }
|
||||
|
||||
[features]
|
||||
default = ['jitdump', 'wat', 'wasi', 'cache']
|
||||
|
||||
2
crates/cache/Cargo.toml
vendored
2
crates/cache/Cargo.toml
vendored
@@ -24,7 +24,7 @@ zstd = { version = "0.9", default-features = false }
|
||||
winapi = "0.3.7"
|
||||
|
||||
[target.'cfg(not(target_os = "windows"))'.dependencies]
|
||||
rustix = "0.31.0"
|
||||
rustix = "0.33.0"
|
||||
|
||||
[dev-dependencies]
|
||||
filetime = "0.2.7"
|
||||
|
||||
@@ -14,7 +14,7 @@ edition = "2018"
|
||||
links = "wasmtime-fiber-shims"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
rustix = "0.31.0"
|
||||
rustix = "0.33.0"
|
||||
|
||||
[target.'cfg(windows)'.dependencies.winapi]
|
||||
version = "0.3.9"
|
||||
|
||||
@@ -32,7 +32,7 @@ log = "0.4.8"
|
||||
winapi = { version = "0.3.8", features = ["winnt", "impl-default"] }
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
rustix = "0.31.0"
|
||||
rustix = "0.33.0"
|
||||
|
||||
[features]
|
||||
jitdump = []
|
||||
|
||||
@@ -30,7 +30,7 @@ anyhow = "1.0.38"
|
||||
mach = "0.3.2"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
rustix = "0.31.0"
|
||||
rustix = "0.33.0"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
winapi = { version = "0.3.7", features = ["winbase", "memoryapi", "errhandlingapi", "handleapi"] }
|
||||
|
||||
@@ -21,7 +21,7 @@ tempfile = "3.1.0"
|
||||
os_pipe = "0.9"
|
||||
anyhow = "1.0.19"
|
||||
wat = "1.0.37"
|
||||
cap-std = "0.22.0"
|
||||
cap-std = "0.24.0"
|
||||
tokio = { version = "1.8.0", features = ["rt-multi-thread"] }
|
||||
|
||||
[features]
|
||||
|
||||
@@ -22,12 +22,12 @@ anyhow = "1.0"
|
||||
thiserror = "1.0"
|
||||
wiggle = { path = "../wiggle", default-features = false, version = "=0.33.0" }
|
||||
tracing = "0.1.19"
|
||||
cap-std = "0.22.0"
|
||||
cap-rand = "0.22.0"
|
||||
cap-std = "0.24.0"
|
||||
cap-rand = "0.24.0"
|
||||
bitflags = "1.2"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
rustix = "0.31.0"
|
||||
rustix = "0.33.0"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winapi = "0.3"
|
||||
|
||||
@@ -15,23 +15,23 @@ include = ["src/**/*", "README.md", "LICENSE" ]
|
||||
wasi-common = { path = "../", version = "=0.33.0" }
|
||||
async-trait = "0.1"
|
||||
anyhow = "1.0"
|
||||
cap-std = "0.22.0"
|
||||
cap-fs-ext = "0.22.0"
|
||||
cap-time-ext = "0.22.0"
|
||||
cap-rand = "0.22.0"
|
||||
fs-set-times = "0.14.1"
|
||||
system-interface = { version = "0.17.0", features = ["cap_std_impls"] }
|
||||
cap-std = "0.24.0"
|
||||
cap-fs-ext = "0.24.0"
|
||||
cap-time-ext = "0.24.0"
|
||||
cap-rand = "0.24.0"
|
||||
fs-set-times = "0.15.0"
|
||||
system-interface = { version = "0.20.0", features = ["cap_std_impls"] }
|
||||
tracing = "0.1.19"
|
||||
io-lifetimes = { version = "0.4.4", default-features = false }
|
||||
io-lifetimes = { version = "0.5.0", default-features = false }
|
||||
is-terminal = "0.1.0"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
rustix = "0.31.0"
|
||||
rustix = "0.33.0"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winapi = "0.3"
|
||||
lazy_static = "1.4"
|
||||
atty = "0.2.14"
|
||||
io-extras = "0.12.0"
|
||||
io-extras = "0.13.0"
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.1.0"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use cap_fs_ext::MetadataExt;
|
||||
use fs_set_times::{SetTimes, SystemTimeSpec};
|
||||
use is_terminal::IsTerminal;
|
||||
use std::any::Any;
|
||||
use std::convert::TryInto;
|
||||
use std::io;
|
||||
@@ -125,14 +126,7 @@ impl WasiFile for File {
|
||||
Ok(self.0.num_ready_bytes()?)
|
||||
}
|
||||
fn isatty(&self) -> bool {
|
||||
#[cfg(unix)]
|
||||
{
|
||||
rustix::io::isatty(&self.0)
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
false
|
||||
}
|
||||
self.0.is_terminal()
|
||||
}
|
||||
async fn readable(&self) -> Result<(), Error> {
|
||||
Err(Error::badf())
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::file::convert_systimespec;
|
||||
use fs_set_times::SetTimes;
|
||||
use io_lifetimes::AsFilelike;
|
||||
use is_terminal::IsTerminal;
|
||||
use std::any::Any;
|
||||
use std::convert::TryInto;
|
||||
use std::fs::File;
|
||||
@@ -111,14 +112,7 @@ impl WasiFile for Stdin {
|
||||
Ok(self.0.num_ready_bytes()?)
|
||||
}
|
||||
fn isatty(&self) -> bool {
|
||||
#[cfg(unix)]
|
||||
{
|
||||
rustix::io::isatty(&self.0)
|
||||
}
|
||||
#[cfg(not(unix))]
|
||||
{
|
||||
atty::is(atty::Stream::Stdin)
|
||||
}
|
||||
self.0.is_terminal()
|
||||
}
|
||||
async fn readable(&self) -> Result<(), Error> {
|
||||
Err(Error::badf())
|
||||
@@ -242,14 +236,7 @@ macro_rules! wasi_file_write_impl {
|
||||
Ok(0)
|
||||
}
|
||||
fn isatty(&self) -> bool {
|
||||
#[cfg(unix)]
|
||||
{
|
||||
rustix::io::isatty(&self.0)
|
||||
}
|
||||
#[cfg(not(unix))]
|
||||
{
|
||||
atty::is(atty::Stream::$ident)
|
||||
}
|
||||
self.0.is_terminal()
|
||||
}
|
||||
async fn readable(&self) -> Result<(), Error> {
|
||||
Err(Error::badf())
|
||||
|
||||
@@ -15,20 +15,20 @@ wasi-common = { path = "../", version = "=0.33.0" }
|
||||
wasi-cap-std-sync = { path = "../cap-std-sync", version = "=0.33.0" }
|
||||
wiggle = { path = "../../wiggle", version = "=0.33.0" }
|
||||
tokio = { version = "1.8.0", features = [ "rt", "fs", "time", "io-util", "net", "io-std", "rt-multi-thread"] }
|
||||
cap-std = "0.22.0"
|
||||
cap-std = "0.24.0"
|
||||
anyhow = "1"
|
||||
io-lifetimes = { version = "0.4.4", default-features = false }
|
||||
io-lifetimes = { version = "0.5.0", default-features = false }
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
rustix = "0.31.0"
|
||||
rustix = "0.33.0"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winapi = "0.3"
|
||||
lazy_static = "1.4"
|
||||
io-extras = "0.12.0"
|
||||
io-extras = "0.13.0"
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.1.0"
|
||||
tokio = { version = "1.8.0", features = [ "macros" ] }
|
||||
anyhow = "1"
|
||||
cap-tempfile = "0.22.0"
|
||||
cap-tempfile = "0.24.0"
|
||||
|
||||
Reference in New Issue
Block a user