From c181bc8015157067e4ad4fd4d77d58776acea127 Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Wed, 11 Mar 2026 18:23:32 +0100 Subject: [PATCH] feat(runtime): forward WEFT_FILE_PORTAL_SOCKET into WASI environment When WEFT_FILE_PORTAL_SOCKET is present in the process environment (set by weft-appd before exec), it is now forwarded into the WASI context so the WASM component can read it via std::env::var or equivalent and locate the per-session file portal socket. --- crates/weft-runtime/src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/weft-runtime/src/main.rs b/crates/weft-runtime/src/main.rs index 1c01673..0e5b92c 100644 --- a/crates/weft-runtime/src/main.rs +++ b/crates/weft-runtime/src/main.rs @@ -146,6 +146,10 @@ fn run_module( ctx_builder.env("WEFT_IPC_SOCKET", socket_path); } + if let Ok(portal_socket) = std::env::var("WEFT_FILE_PORTAL_SOCKET") { + ctx_builder.env("WEFT_FILE_PORTAL_SOCKET", &portal_socket); + } + for (host_path, guest_path) in preopen { let dir = Dir::open_ambient_dir(host_path, ambient_authority()) .with_context(|| format!("open preopen dir {host_path}"))?;