diff options
Diffstat (limited to 'src/wasm/nxt_rt_wasmtime.c')
-rw-r--r-- | src/wasm/nxt_rt_wasmtime.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/wasm/nxt_rt_wasmtime.c b/src/wasm/nxt_rt_wasmtime.c index 07a6165a..99786b89 100644 --- a/src/wasm/nxt_rt_wasmtime.c +++ b/src/wasm/nxt_rt_wasmtime.c @@ -247,6 +247,7 @@ nxt_wasmtime_get_function_exports(nxt_wasm_ctx_t *ctx) static int nxt_wasmtime_wasi_init(const nxt_wasm_ctx_t *ctx) { + char **dir; wasi_config_t *wasi_config; wasmtime_error_t *error; nxt_wasmtime_ctx_t *rt_ctx = &nxt_wasmtime_ctx; @@ -258,6 +259,10 @@ nxt_wasmtime_wasi_init(const nxt_wasm_ctx_t *ctx) wasi_config_inherit_stdout(wasi_config); wasi_config_inherit_stderr(wasi_config); + for (dir = ctx->dirs; dir != NULL && *dir != NULL; dir++) { + wasi_config_preopen_dir(wasi_config, *dir, *dir); + } + error = wasmtime_context_set_wasi(rt_ctx->ctx, wasi_config); if (error != NULL) { nxt_wasmtime_err_msg(error, NULL, "failed to instantiate WASI"); |