mirror of
https://github.com/mudler/luet.git
synced 2025-09-20 18:51:23 +00:00
This reverts commit db8e3da01f
.
This commit is contained in:
committed by
GitHub
parent
db8e3da01f
commit
f8350a2f07
16
vendor/github.com/moby/term/windows/console.go
generated
vendored
16
vendor/github.com/moby/term/windows/console.go
generated
vendored
@@ -1,11 +1,11 @@
|
||||
// +build windows
|
||||
|
||||
package windowsconsole
|
||||
package windowsconsole // import "github.com/moby/term/windows"
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
"github.com/Azure/go-ansiterm/winterm"
|
||||
)
|
||||
|
||||
// GetHandleInfo returns file descriptor and bool indicating whether the file is a console.
|
||||
@@ -22,18 +22,14 @@ func GetHandleInfo(in interface{}) (uintptr, bool) {
|
||||
|
||||
if file, ok := in.(*os.File); ok {
|
||||
inFd = file.Fd()
|
||||
isTerminal = isConsole(inFd)
|
||||
isTerminal = IsConsole(inFd)
|
||||
}
|
||||
return inFd, isTerminal
|
||||
}
|
||||
|
||||
// IsConsole returns true if the given file descriptor is a Windows Console.
|
||||
// The code assumes that GetConsoleMode will return an error for file descriptors that are not a console.
|
||||
// Deprecated: use golang.org/x/sys/windows.GetConsoleMode() or golang.org/x/term.IsTerminal()
|
||||
var IsConsole = isConsole
|
||||
|
||||
func isConsole(fd uintptr) bool {
|
||||
var mode uint32
|
||||
err := windows.GetConsoleMode(windows.Handle(fd), &mode)
|
||||
return err == nil
|
||||
func IsConsole(fd uintptr) bool {
|
||||
_, e := winterm.GetConsoleMode(fd)
|
||||
return e == nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user