Flush emits any remaining buffered content as a final line.
()
| 291 | |
| 292 | // Flush emits any remaining buffered content as a final line. |
| 293 | func (sw *StreamWriter) Flush() { |
| 294 | sw.mu.Lock() |
| 295 | defer sw.mu.Unlock() |
| 296 | if len(sw.buf) > 0 && sw.onOutput != nil { |
| 297 | sw.onOutput(string(sw.buf)) |
| 298 | sw.buf = sw.buf[:0] |
| 299 | } |
| 300 | } |