Read stderr lines until one contains `marker`, returning that line.
(&mut self, marker: &str, timeout: Duration)
| 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. |