MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / output

Method output

examples/min-platform/embedding/src/wasi.rs:185–202  ·  view source on GitHub ↗

Collect all of the output written to stdout and stderr into a simple human-readable string, to be written to out_buf from run_wasi on success. Lossy utf8 conversion because this is an example.

(&self)

Source from the content-addressed store, hash-verified

183 // human-readable string, to be written to out_buf from run_wasi on
184 // success. Lossy utf8 conversion because this is an example.
185 fn output(&self) -> Result<String> {
186 let mut out = String::new();
187 let stdout = self.stdout.log.borrow();
188 if !stdout.is_empty() {
189 write!(&mut out, "stdout:\n")?;
190 for chunk in stdout.iter() {
191 write!(&mut out, "{}", String::from_utf8_lossy(chunk))?;
192 }
193 }
194 let stderr = self.stderr.log.borrow();
195 if !stderr.is_empty() {
196 write!(&mut out, "stderr:\n")?;
197 for chunk in stderr.iter() {
198 write!(&mut out, "{}", String::from_utf8_lossy(chunk))?;
199 }
200 }
201 Ok(out)
202 }
203}
204
205// Add the minimum number of wasi interfaces to the Linker to instantiate the

Callers 15

run_perf_recordMethod · 0.80
run_perf_scriptMethod · 0.80
cmd_outputFunction · 0.80
discover_test_binariesFunction · 0.80
find_llvm_toolFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
run_testFunction · 0.80
rustcFunction · 0.80
run_wasmtime_for_outputFunction · 0.80
specify_envFunction · 0.80

Calls 5

OkFunction · 0.85
newFunction · 0.50
borrowMethod · 0.45
is_emptyMethod · 0.45
iterMethod · 0.45

Tested by 15

mainFunction · 0.64
run_wasmtime_for_outputFunction · 0.64
specify_envFunction · 0.64
run_cwasm_from_stdinFunction · 0.64
run_just_stdin_argumentFunction · 0.64
wasi_misaligned_pointerFunction · 0.64
bad_text_syntaxFunction · 0.64
memory_growth_failureFunction · 0.64