MCPcopy Index your code
hub / github.com/coder/coder / Write

Method Write

testutil/wait_buffer.go:38–50  ·  view source on GitHub ↗

Write implements io.Writer. It is safe for concurrent use.

(p []byte)

Source from the content-addressed store, hash-verified

36
37// Write implements io.Writer. It is safe for concurrent use.
38func (wb *WaitBuffer) Write(p []byte) (int, error) {
39 wb.mu.Lock()
40 defer wb.mu.Unlock()
41
42 n, err := wb.buf.Write(p)
43 s := wb.buf.String()
44 for _, w := range wb.waiters {
45 if w.cond(s) {
46 w.once.Do(func() { close(w.ch) })
47 }
48 }
49 return n, err
50}
51
52// WaitFor blocks until the accumulated output contains signal or
53// ctx expires. Returns nil on match, ctx.Err() on timeout.

Calls 5

WriteMethod · 0.65
DoMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45
StringMethod · 0.45