From 21a13f34440622bc194f6f1a29bbc532c4afc2e2 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Mon, 2 Dec 2024 21:00:20 +0100 Subject: [PATCH] feat: add inherit Signed-off-by: kjuulh --- crates/churn/src/agent/plugins.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/churn/src/agent/plugins.rs b/crates/churn/src/agent/plugins.rs index fa115c1..6a3651a 100644 --- a/crates/churn/src/agent/plugins.rs +++ b/crates/churn/src/agent/plugins.rs @@ -6,7 +6,7 @@ use tokio::io::AsyncWriteExt; use tokio::sync::Mutex; use wasmtime::component::*; use wasmtime::{Config, Engine, Store}; -use wasmtime_wasi::{WasiCtx, WasiCtxBuilder, WasiView}; +use wasmtime_wasi::{DirPerms, FilePerms, WasiCtx, WasiCtxBuilder, WasiView}; wasmtime::component::bindgen!({ path: "wit/world.wit", @@ -144,7 +144,14 @@ struct ServerWasiView { impl ServerWasiView { fn new() -> Self { let table = ResourceTable::new(); - let ctx = WasiCtxBuilder::new().inherit_stdio().build(); + + let ctx = WasiCtxBuilder::new() + .inherit_stdio() + .inherit_env() + .inherit_network() + .preopened_dir("/", "/", DirPerms::all(), FilePerms::all()) + .expect("to be able to open root") + .build(); Self { table, ctx } }