File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,8 @@ var validColors = map[string]bool{
100
100
}
101
101
102
102
// returns true if the OS is windows and the WT_SESSION env variable is set.
103
- var isWindowsTerminalOnWindows = len (os .Getenv ("WT_SESSION" )) > 0 && runtime .GOOS == "windows"
103
+ var isWindows = runtime .GOOS == "windows"
104
+ var isWindowsTerminalOnWindows = len (os .Getenv ("WT_SESSION" )) > 0 && isWindows
104
105
105
106
// returns a valid color's foreground text color attribute
106
107
var colorAttributeMap = map [string ]color.Attribute {
@@ -281,6 +282,12 @@ func (s *Spinner) Start() {
281
282
// hides the cursor
282
283
fmt .Fprint (s .Writer , "\033 [?25l" )
283
284
}
285
+ // Disable colors for simple Windows CMD or Powershell
286
+ // as they can not recognize them
287
+ if isWindows && ! isWindowsTerminalOnWindows {
288
+ color .NoColor = true
289
+ }
290
+
284
291
s .active = true
285
292
s .mu .Unlock ()
286
293
@@ -305,7 +312,7 @@ func (s *Spinner) Start() {
305
312
}
306
313
307
314
var outColor string
308
- if runtime . GOOS == "windows" {
315
+ if isWindows {
309
316
if s .Writer == os .Stderr {
310
317
outColor = fmt .Sprintf ("\r %s%s%s" , s .Prefix , s .chars [i ], s .Suffix )
311
318
} else {
You can’t perform that action at this time.
0 commit comments