Fix isatty in WASI. (#3696)

WASI doesn't have an `isatty` ioctl or syscall, so wasi-libc's `isatty`
implementation uses the file descriptor type and rights to determine if
the file descriptor is likely to be a tty. The real fix here will be to
add an `isatty` call to WASI. But for now, have Wasmtime set the
filetype and rights for file descriptors so that wasi-libc's `isatty`
works as expected.
This commit is contained in:
Dan Gohman
2022-01-24 11:45:16 -08:00
committed by GitHub
parent b1ad02e43a
commit 5fc01bafc7
8 changed files with 74 additions and 8 deletions

View File

@@ -34,6 +34,7 @@ pub trait WasiFile: Send + Sync {
async fn seek(&self, pos: std::io::SeekFrom) -> Result<u64, Error>; // file op that generates a new stream from a file will supercede this
async fn peek(&self, buf: &mut [u8]) -> Result<u64, Error>; // read op
async fn num_ready_bytes(&self) -> Result<u64, Error>; // read op
fn isatty(&self) -> bool;
async fn readable(&self) -> Result<(), Error>;
async fn writable(&self) -> Result<(), Error>;