summaryrefslogtreecommitdiffstats
path: root/client/go/util/spinner.go
diff options
context:
space:
mode:
Diffstat (limited to 'client/go/util/spinner.go')
-rw-r--r--client/go/util/spinner.go16
1 files changed, 2 insertions, 14 deletions
diff --git a/client/go/util/spinner.go b/client/go/util/spinner.go
index bdce2dbfabe..39b00352c32 100644
--- a/client/go/util/spinner.go
+++ b/client/go/util/spinner.go
@@ -4,12 +4,10 @@ package util
import (
"io"
- "os"
"strings"
"time"
"github.com/briandowns/spinner"
- "github.com/mattn/go-isatty"
)
// Spinner writes message to writer w and executes function fn. While fn is running a spinning animation will be
@@ -24,21 +22,11 @@ func Spinner(w io.Writer, message string, fn func() error) error {
}
s.Prefix = message
s.FinalMSG = "\r" + message + "done\n"
- isTerminal := isTerminal(w)
- if isTerminal { // spinner package does this check too, but it's hardcoded to check os.Stdout :(
- s.Start()
- }
+ s.Start()
err := fn()
- if isTerminal {
- s.Stop()
- }
if err != nil {
s.FinalMSG = "\r" + message + "failed\n"
}
+ s.Stop()
return err
}
-
-func isTerminal(w io.Writer) bool {
- f, ok := w.(*os.File)
- return ok && isatty.IsTerminal(f.Fd())
-}