zfs: send: improve error reporting by capturing stderr

This commit is contained in:
Christian Schwarz
2019-09-17 00:29:58 +02:00
parent e675b35cda
commit 99ab16d7be
2 changed files with 20 additions and 5 deletions

View File

@@ -27,6 +27,14 @@ type CircularLog struct {
mtx sync.Mutex
}
func MustNewCircularLog(max int) *CircularLog {
log, err := NewCircularLog(max)
if err != nil {
panic(err)
}
return log
}
func NewCircularLog(max int) (*CircularLog, error) {
if max <= 0 {
return nil, fmt.Errorf("max must be positive")