Skip to content

Commit 12126ed

Browse files
authored
Merge pull request #188 from pellared/patch-1
Refactor color_windows.go
2 parents c5d9a2b + 770038b commit 12126ed

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

color_windows.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ func init() {
1111
// https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#output-sequences
1212
var outMode uint32
1313
out := windows.Handle(os.Stdout.Fd())
14-
if err := windows.GetConsoleMode(out, &outMode); err == nil {
15-
outMode |= windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING
16-
_ = windows.SetConsoleMode(out, outMode)
14+
if err := windows.GetConsoleMode(out, &outMode); err != nil {
15+
return
1716
}
17+
outMode |= windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING
18+
_ = windows.SetConsoleMode(out, outMode)
1819
}

0 commit comments

Comments
 (0)