wasiExec
wasiExec(
opts):Promise<ExitCode>
Defined in: packages/runtime/src/wasm/wasi-exec.ts:90
Run a pre-compiled WASI module inside a fishbowl process.
Routes wasi_snapshot_preview1 syscalls directly to proc.fs via
WasiHost — there is no MEMFS shadow layer. Handles both
non-asyncified modules (direct _start()) and asyncified ones (driven by
RawAsyncify.runLoop()). Exits cleanly when the guest calls proc_exit.
Parameters
Section titled “Parameters”See WasiExecOptions.
Returns
Section titled “Returns”Promise<ExitCode>
The exit code returned by the program (or thrown via proc_exit).
Throws
Section titled “Throws”Error if the module has no _start export and is not asyncified.
Caveat
Section titled “Caveat”RawAsyncify may call memory.grow() inside its constructor to
allocate the asyncify data buffer, which detaches the cached
WasiMemory views. We rebind memory immediately after constructing
RawAsyncify — before any WASI import is called.
Example
Section titled “Example”import { wasiExec, getWasmApi } from '@fishnet/runtime/wasm'const mod = await getWasmApi().compile(wasmBytes)const code = await wasiExec({ wasmModule: mod, proc, args: proc.argv })