This commit adds catpure of os.Std{out,err} when running osbuild so
that we capture the error log and can display it as part of
an error from osbuild, e.g. when osbuild itself crashes.
This gives us more accurate error reporting if anything fails
during the osbuild building.
35 lines
593 B
Go
35 lines
593 B
Go
package progress
|
|
|
|
import (
|
|
"io"
|
|
)
|
|
|
|
type (
|
|
TerminalProgressBar = terminalProgressBar
|
|
DebugProgressBar = debugProgressBar
|
|
VerboseProgressBar = verboseProgressBar
|
|
)
|
|
|
|
func MockOsStderr(w io.Writer) (restore func()) {
|
|
saved := osStderr
|
|
osStderr = 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
|
|
}
|
|
}
|