diff --git a/lib/wasix/src/state/env.rs b/lib/wasix/src/state/env.rs index d0dbd1652c6..4b0a8f819f9 100644 --- a/lib/wasix/src/state/env.rs +++ b/lib/wasix/src/state/env.rs @@ -851,6 +851,12 @@ impl WasiEnv { (memory, state, inodes) } + pub(crate) fn get_wasi_state_and_inodes(&self) -> (&WasiState, &WasiInodes) { + let state = self.state.deref(); + let inodes = &state.inodes; + (state, inodes) + } + /// Make all the commands in a [`BinaryPackage`] available to the WASI /// instance. /// diff --git a/lib/wasix/src/syscalls/wasix/proc_spawn.rs b/lib/wasix/src/syscalls/wasix/proc_spawn.rs index 552d75ba5a2..dc4ee8722d5 100644 --- a/lib/wasix/src/syscalls/wasix/proc_spawn.rs +++ b/lib/wasix/src/syscalls/wasix/proc_spawn.rs @@ -145,8 +145,7 @@ pub fn proc_spawn_internal( // Replace the STDIO let (stdin, stdout, stderr) = { - let (_, child_state, child_inodes) = - unsafe { child_env.get_memory_and_wasi_state_and_inodes(&new_store, 0) }; + let (child_state, child_inodes) = child_env.get_wasi_state_and_inodes(); let mut conv_stdio_mode = |mode: WasiStdioMode, fd: WasiFd| -> Result { match mode { WasiStdioMode::Piped => {