MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / waitForText

Method waitForText

freebuff/e2e/utils/freebuff-session.ts:163–175  ·  view source on GitHub ↗

* Poll until the terminal output contains the given text. * Throws if the timeout is exceeded.

(pattern: string, timeoutMs = 30_000)

Source from the content-addressed store, hash-verified

161 * Throws if the timeout is exceeded.
162 */
163 async waitForText(pattern: string, timeoutMs = 30_000): Promise<string> {
164 const start = Date.now()
165 while (Date.now() - start < timeoutMs) {
166 const output = await this.capture()
167 if (output.includes(pattern)) return output
168 await new Promise((resolve) => setTimeout(resolve, 500))
169 }
170 const finalOutput = await this.capture()
171 throw new Error(
172 `Timed out after ${timeoutMs}ms waiting for "${pattern}".\n` +
173 `Last output:\n${finalOutput}`,
174 )
175 }
176
177 /** Stop the tmux session and clean up the temp directory. */
178 async stop(): Promise<void> {

Callers 3

openHelpFunction · 0.80

Calls 2

captureMethod · 0.95
setTimeoutFunction · 0.85

Tested by 1

openHelpFunction · 0.64