Browse Source

dont crash when redirecting stderr

Jeffrey Morgan 1 năm trước cách đây
mục cha
commit
e6ad4813d3
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      progress/bar.go

+ 1 - 1
progress/bar.go

@@ -37,7 +37,7 @@ func NewBar(message string, maxValue, initialValue int64) *Bar {
 func (b *Bar) String() string {
 	termWidth, _, err := term.GetSize(int(os.Stderr.Fd()))
 	if err != nil {
-		panic(err)
+		termWidth = 80
 	}
 
 	var pre, mid, suf strings.Builder