Updates for the review comments

This commit is contained in:
Johnathan Sharratt
2023-03-09 16:11:42 +11:00
parent 1c85b34031
commit 80b10fcba7
3 changed files with 20 additions and 22 deletions

View File

@@ -7,6 +7,8 @@ use std::{collections::BTreeSet, path::Path};
use wasmer::{AsStoreMut, Instance, Module, RuntimeError, Value};
use wasmer_vfs::FileSystem;
use wasmer_vfs::{DeviceFile, PassthruFileSystem, RootFileSystemBuilder};
use wasmer_wasi::os::tty_sys::SysTyy;
use wasmer_wasi::os::TtyBridge;
use wasmer_wasi::types::__WASI_STDIN_FILENO;
use wasmer_wasi::{
default_fs_backing, get_wasi_versions, PluggableRuntimeImplementation, WasiEnv, WasiError,
@@ -60,6 +62,10 @@ pub struct Wasi {
#[clap(long = "net")]
pub networking: bool,
/// Disables the TTY bridge
#[clap(long = "no-tty")]
pub no_tty: bool,
/// Allow instances to send http requests.
///
/// Access to domains is granted by default.
@@ -128,6 +134,12 @@ impl Wasi {
rt.set_networking_implementation(wasmer_vnet::UnsupportedVirtualNetworking::default());
}
if self.no_tty == false {
let tty = Arc::new(SysTyy::default());
tty.reset();
rt.set_tty(tty)
}
let engine = store.as_store_mut().engine().clone();
rt.set_engine(Some(engine));