Merge branch 'master' into dash-fixes-and-pthreads

This commit is contained in:
Johnathan Sharratt
2023-03-17 04:23:38 +11:00
72 changed files with 309 additions and 330 deletions

View File

@@ -21,7 +21,7 @@ use wasmer::*;
use wasmer_cache::{Cache, FileSystemCache, Hash};
use wasmer_types::Type as ValueType;
#[cfg(feature = "webc_runner")]
use wasmer_wasi::runners::{Runner, WapmContainer};
use wasmer_wasix::runners::{Runner, WapmContainer};
#[cfg(feature = "wasi")]
mod wasi;
@@ -288,7 +288,7 @@ impl RunWithPathBuf {
#[cfg(feature = "wasi")]
let ret = {
use std::collections::BTreeSet;
use wasmer_wasi::WasiVersion;
use wasmer_wasix::WasiVersion;
let wasi_versions = Wasi::get_versions(&module);
match wasi_versions {
@@ -393,14 +393,14 @@ impl RunWithPathBuf {
.with_context(|| format!("No metadata found for the command, \"{id}\""))?;
let (store, _compiler_type) = self.store.get_store()?;
let mut runner = wasmer_wasi::runners::wasi::WasiRunner::new(store);
let mut runner = wasmer_wasix::runners::wasi::WasiRunner::new(store);
runner.set_args(args.to_vec());
if runner.can_run_command(id, command).unwrap_or(false) {
return runner.run_cmd(&container, id).context("WASI runner failed");
}
let (store, _compiler_type) = self.store.get_store()?;
let mut runner = wasmer_wasi::runners::emscripten::EmscriptenRunner::new(store);
let mut runner = wasmer_wasix::runners::emscripten::EmscriptenRunner::new(store);
runner.set_args(args.to_vec());
if runner.can_run_command(id, command).unwrap_or(false) {
return runner
@@ -408,7 +408,7 @@ impl RunWithPathBuf {
.context("Emscripten runner failed");
}
let mut runner = wasmer_wasi::runners::wcgi::WcgiRunner::new(id);
let mut runner = wasmer_wasix::runners::wcgi::WcgiRunner::new(id);
let (store, _compiler_type) = self.store.get_store()?;
runner
.config()

View File

@@ -4,13 +4,13 @@ use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
use std::{collections::BTreeSet, path::Path};
use virtual_fs::FileSystem;
use virtual_fs::{DeviceFile, PassthruFileSystem, RootFileSystemBuilder};
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::{
use wasmer_wasix::os::tty_sys::SysTty;
use wasmer_wasix::os::TtyBridge;
use wasmer_wasix::types::__WASI_STDIN_FILENO;
use wasmer_wasix::{
default_fs_backing, get_wasi_versions, PluggableRuntimeImplementation, WasiEnv, WasiError,
WasiFunctionEnv, WasiVersion,
};
@@ -132,15 +132,13 @@ impl Wasi {
let mut rt = PluggableRuntimeImplementation::default();
if self.networking {
rt.set_networking_implementation(
wasmer_wasi_local_networking::LocalNetworking::default(),
);
rt.set_networking_implementation(virtual_net::host::LocalNetworking::default());
} else {
rt.set_networking_implementation(wasmer_vnet::UnsupportedVirtualNetworking::default());
rt.set_networking_implementation(virtual_net::UnsupportedVirtualNetworking::default());
}
if !self.no_tty {
let tty = Arc::new(SysTyy::default());
let tty = Arc::new(SysTty::default());
tty.reset();
rt.set_tty(tty)
}
@@ -156,7 +154,7 @@ impl Wasi {
.include_webcs(self.include_webcs.clone())
.map_commands(map_commands);
let mut builder = if wasmer_wasi::is_wasix_module(module) {
let mut builder = if wasmer_wasix::is_wasix_module(module) {
// If we preopen anything from the host then shallow copy it over
let root_fs = RootFileSystemBuilder::new()
.with_tty(Box::new(DeviceFile::new(__WASI_STDIN_FILENO)))
@@ -187,7 +185,7 @@ impl Wasi {
};
if self.http_client {
let caps = wasmer_wasi::http::HttpClientCapabilityV1::new_allow_all();
let caps = wasmer_wasix::http::HttpClientCapabilityV1::new_allow_all();
builder.capabilities_mut().http_client = caps;
}