debian-forge-cli/bib/pkg/progress/export_test.go
Michael Vogt 7ac659490c 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.
2025-03-31 19:42:59 +00:00

47 lines
818 B
Go

package progress
import (
"io"
)
type (
TerminalProgressBar = terminalProgressBar
DebugProgressBar = debugProgressBar
VerboseProgressBar = verboseProgressBar
)
var (
NewSyncedWriter = newSyncedWriter
)
func MockOsStdout(w io.Writer) (restore func()) {
saved := osStdout
osStdout = func() io.Writer { return w }
return func() {
osStdout = saved
}
}
func MockOsStderr(w io.Writer) (restore func()) {
saved := osStderr
osStderr = func() io.Writer { return w }
return func() {
osStderr = saved
}
}
func MockIsattyIsTerminal(fn func(uintptr) bool) (restore func()) {
saved := isattyIsTerminal
isattyIsTerminal = fn
return func() {
isattyIsTerminal = saved
}
}
func MockOsbuildCmd(s string) (restore func()) {
saved := osbuildCmd
osbuildCmd = s
return func() {
osbuildCmd = saved
}
}