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

Method wait_for_stderr

tests/all/guest_debug/mod.rs:104–121  ·  view source on GitHub ↗

Read stderr lines until one contains `marker`, returning that line.

(&mut self, marker: &str, timeout: Duration)

Source from the content-addressed store, hash-verified

102
103 /// Read stderr lines until one contains `marker`, returning that line.
104 fn wait_for_stderr(&mut self, marker: &str, timeout: Duration) -> Result<String> {
105 let deadline = std::time::Instant::now() + timeout;
106 let mut line = String::new();
107 loop {
108 if std::time::Instant::now() > deadline {
109 bail!("timed out waiting for '{marker}' on stderr");
110 }
111 line.clear();
112 self.stderr_reader.read_line(&mut line)?;
113 eprintln!("wasmtime stderr: {}", line.trim_end());
114 if line.contains(marker) {
115 return Ok(line);
116 }
117 if line.is_empty() {
118 bail!("wasmtime stderr closed before finding '{marker}'");
119 }
120 }
121 }
122}
123
124/// Run an LLDB debug script against a gdbstub endpoint.

Callers 2

Calls 5

OkFunction · 0.85
newFunction · 0.50
clearMethod · 0.45
containsMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected