From c40cb27d193722f314fbb8cf8b67cc5298897dc8 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 15 Jul 2015 11:23:48 -0700 Subject: [PATCH] ts.GetSize() error should fail on error --- pb.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pb.go b/pb.go index 129c85ad..6fb4074a 100644 --- a/pb.go +++ b/pb.go @@ -215,7 +215,10 @@ type scanBarFunc func(string) func scanBarFactory(prefix string) scanBarFunc { prevLineSize := 0 fileCount := 0 - termSize, _ := ts.GetSize() + termSize, err := ts.GetSize() + if err != nil { + console.Fatalf("Unable to get terminal size. %s\n", err) + } termWidth := termSize.Col() cursorCh := cursorAnimate() @@ -224,7 +227,6 @@ func scanBarFactory(prefix string) scanBarFunc { if prevLineSize != 0 { // erase previous line console.PrintC("\r" + scanPrefix + strings.Repeat(" ", prevLineSize-len([]rune(scanPrefix)))) } - source = fixateScanBar(source, termWidth-len([]rune(scanPrefix))-1) barText := "\r" + scanPrefix + source console.PrintC(barText)