func (l *IntervalProcessWriter) Close() error {
	l.closed <- struct{}{}
	<-l.done
	return nil
}
Close blocks until all pending writes have been flushed to the buffer. It
then causes the underlying goroutine to exit.
package ui
import (
	"bytes"
	"context"
	"io"
	"time"
	"github.com/derision-test/glock"
)
type IntervalProcessWriter struct {
	sink func(string)
	ticker glock.Ticker
	buf        *bytes.Buffer
	writes     chan []byte
	writesDone chan struct{}
	closed chan struct{}
	done   chan struct{}
}
func newIntervalProcessWriter(ctx context.Context, ticker glock.Ticker, sink func(string)) *IntervalProcessWriter {
	l := &IntervalProcessWriter{
		sink:   sink,
		ticker: ticker,
		writes:     make(chan []byte),
		writesDone: make(chan struct{}),
		buf: &bytes.Buffer{},
		closed: make(chan struct{}, 1),
		done:   make(chan struct{}, 1),
	}
	go l.writeLines(ctx)
	return l
}
func NewIntervalProcessWriter(ctx context.Context, interval time.Duration, sink func(string)) *IntervalProcessWriter {
	return newIntervalProcessWriter(ctx, glock.NewRealTicker(interval), sink)
}
func (l *IntervalProcessWriter) StdoutWriter() io.Writer {
	return &prefixedWriter{writes: l.writes, writesDone: l.writesDone, prefix: "stdout: "}
}
func (l *IntervalProcessWriter) StderrWriter() io.Writer {
	return &prefixedWriter{writes: l.writes, writesDone: l.writesDone, prefix: "stderr: "}
}