progress: add new BuildLog option
This commit adds a new `BuildLog` option to the `OSBuildOptions` that can be used to generate a streamed buildlog (e.g. to a file or a websocket). This will be used in `ibcli` with a new `--with-buildlog` option.
This commit is contained in:
parent
a875a16309
commit
7ac659490c
5 changed files with 210 additions and 5 deletions
22
bib/pkg/progress/syncwriter.go
Normal file
22
bib/pkg/progress/syncwriter.go
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
package progress
|
||||
|
||||
import (
|
||||
"io"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type syncedWriter struct {
|
||||
mu *sync.Mutex
|
||||
w io.Writer
|
||||
}
|
||||
|
||||
func newSyncedWriter(mu *sync.Mutex, w io.Writer) io.Writer {
|
||||
return &syncedWriter{mu: mu, w: w}
|
||||
}
|
||||
|
||||
func (sw *syncedWriter) Write(p []byte) (n int, err error) {
|
||||
sw.mu.Lock()
|
||||
defer sw.mu.Unlock()
|
||||
|
||||
return sw.w.Write(p)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue