Stream: git-wasmtime

Topic: wasmtime / issue #4372 C binding: wasi std out to string


view this post on Zulip Wasmtime GitHub notifications bot (Jul 03 2022 at 16:34):

ShuP1 opened issue #4372:

Feature

Rust library can bind WritePipe to WasiCtx stdout which can be far simpler and effective than OS files went dealing with multiple short-lived instances.

It is not currently possible with C/C++ bindings

Benefit

Implementation

Leverage existing wasi_common::pipe::WritePipe and ReadPipe on the rust side to implemented a binding in c-api crate.

Alternatives

Export some basic filesystem operations in c binding

view this post on Zulip Wasmtime GitHub notifications bot (Jul 06 2022 at 15:57):

alexcrichton labeled issue #4372:

Feature

Rust library can bind WritePipe to WasiCtx stdout which can be far simpler and effective than OS files went dealing with multiple short-lived instances.

It is not currently possible with C/C++ bindings

Benefit

Implementation

Leverage existing wasi_common::pipe::WritePipe and ReadPipe on the rust side to implemented a binding in c-api crate.

Alternatives

Export some basic filesystem operations in c binding

view this post on Zulip Wasmtime GitHub notifications bot (Aug 05 2022 at 12:28):

gzurl commented on issue #4372:

+1 for this feature.

When embedding Wasmtime in C (or C++), and enabling WASI extensions for a Wasm module, there is no way to capture stdout into a string. The only alternative seems to use [wasi.h]wasi_config_set_stdout_file(), which brings many other drawbacks (ie: no buffering, slow down, etc.)

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2022 at 06:20):

guregu commented on issue #4372:

Is this the blocker issue for https://github.com/bytecodealliance/wasmtime-go/issues/34 and https://github.com/bytecodealliance/wasmtime-py/issues/34? (cc @alexcrichton)

I would love to switch to wasmtime for my projects but this is preventing me from doing so.
We also need the ability to set a string for stdin as well. I'm not sure if there is a separate issue for that.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2022 at 15:22):

alexcrichton commented on issue #4372:

Yes this is required for those issues.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 02 2022 at 15:06):

ShuP1 commented on issue #4372:

The binding for stdout/stderr is a bit more complicated

First this api needs to return a new opaque struct for retrieve output after store drop.

Furthermore there is 2 properties of WritePipe than should probably be accessible:

view this post on Zulip Wasmtime GitHub notifications bot (Nov 02 2022 at 15:12):

ShuP1 commented on issue #4372:

Side question: is stdin streaming a desired feature ?

wasi_read_pipe_t in;
wasi_config_set_stdin_pipe(wasi_config, &in);
...
wasi_read_pipe_write(&in, &binary);
wasmtime_func_call(...); // consume stdin
wasi_read_pipe_write(&in, &binary);
wasmtime_func_call(...);
wasi_read_pipe_delete(&in);


Last updated: Dec 23 2024 at 12:05 UTC