Enable to run build and invoke in background

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
This commit is contained in:
Kohei Tokunaga
2022-08-29 14:14:14 +09:00
parent b1b4e64c97
commit a27b8395b1
80 changed files with 24862 additions and 678 deletions

View File

@ -68,3 +68,24 @@ func NewChannel(w Writer) (chan *client.SolveStatus, chan struct{}) {
}()
return ch, done
}
type tee struct {
Writer
ch chan *client.SolveStatus
}
func (t *tee) Write(v *client.SolveStatus) {
v2 := *v
t.ch <- &v2
t.Writer.Write(v)
}
func Tee(w Writer, ch chan *client.SolveStatus) Writer {
if ch == nil {
return w
}
return &tee{
Writer: w,
ch: ch,
}
}