Skip to content

support setting bytes for stdin #405

Open
@tiziano88

Description

Motivation

It is quite common to have to provide a pre-determined stdin value to a Wasm module, without having to expose a full file system to it.

Proposed solution

leverage this function:

https://docs.wasmtime.dev/c-api/wasi_8h.html#a525abd98ade58887a969b796ea05468e

would require modifying

#if defined(WASMER_WASI_ENABLED)
void wasi_config_inherit_stdin(struct wasi_config_t *config);
#endif

and

wasmer-go/wasmer/wasi.go

Lines 196 to 202 in ca60a45

// InheritStdin configures the WASI module to inherit the stdin from
// the host.
func (self *WasiStateBuilder) InheritStdin() *WasiStateBuilder {
C.wasi_config_inherit_stdin(self.inner())
return self
}

Alternatives

The best alternative at the moment is passing the value as argument on the command line, but that's not great for large and / or binary values.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions