mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
a43a8ee50d
Bumps [github.com/jedib0t/go-pretty/v6](https://github.com/jedib0t/go-pretty) from 6.2.4 to 6.6.5. - [Release notes](https://github.com/jedib0t/go-pretty/releases) - [Commits](https://github.com/jedib0t/go-pretty/compare/v6.2.4...v6.6.5) --- updated-dependencies: - dependency-name: github.com/jedib0t/go-pretty/v6 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
31 lines
599 B
Go
31 lines
599 B
Go
//go:build windows
|
|
// +build windows
|
|
|
|
package text
|
|
|
|
import (
|
|
"os"
|
|
"sync"
|
|
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
var enableVTPMutex = sync.Mutex{}
|
|
|
|
func areANSICodesSupported() bool {
|
|
enableVTPMutex.Lock()
|
|
defer enableVTPMutex.Unlock()
|
|
|
|
outHandle := windows.Handle(os.Stdout.Fd())
|
|
var outMode uint32
|
|
if err := windows.GetConsoleMode(outHandle, &outMode); err == nil {
|
|
if outMode&windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING != 0 {
|
|
return true
|
|
}
|
|
if err := windows.SetConsoleMode(outHandle, outMode|windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING); err == nil {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|