mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-20 10:27:46 +08:00

1.6.0 -------------------------- Fixes: * end of line cleanup * revert the entry concurrency bug fix whic leads to deadlock under some circumstances * update dependency on go-windows-terminal-sequences to fix a crash with go 1.14 Features: * add an option to the `TextFormatter` to completely disable fields quoting 1.5.0 -------------------------- Code quality: * add golangci linter run on travis Fixes: * add mutex for hooks concurrent access on `Entry` data * caller function field for go1.14 * fix build issue for gopherjs target Feature: * add an hooks/writer sub-package whose goal is to split output on different stream depending on the trace level * add a `DisableHTMLEscape` option in the `JSONFormatter` * add `ForceQuote` and `PadLevelText` options in the `TextFormatter` Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
36 lines
689 B
Go
36 lines
689 B
Go
// +build windows
|
|
|
|
package sequences
|
|
|
|
import (
|
|
"syscall"
|
|
)
|
|
|
|
var (
|
|
kernel32Dll *syscall.LazyDLL = syscall.NewLazyDLL("Kernel32.dll")
|
|
setConsoleMode *syscall.LazyProc = kernel32Dll.NewProc("SetConsoleMode")
|
|
)
|
|
|
|
func EnableVirtualTerminalProcessing(stream syscall.Handle, enable bool) error {
|
|
const ENABLE_VIRTUAL_TERMINAL_PROCESSING uint32 = 0x4
|
|
|
|
var mode uint32
|
|
err := syscall.GetConsoleMode(syscall.Stdout, &mode)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if enable {
|
|
mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING
|
|
} else {
|
|
mode &^= ENABLE_VIRTUAL_TERMINAL_PROCESSING
|
|
}
|
|
|
|
ret, _, err := setConsoleMode.Call(uintptr(stream), uintptr(mode))
|
|
if ret == 0 {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|