summaryrefslogtreecommitdiff
path: root/vendor/github.com/Azure/go-ansiterm/winterm
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2021-09-15 15:46:26 -0400
committerMatthew Heon <mheon@redhat.com>2021-09-16 11:00:05 -0400
commit69e327378f16a6abccc74191b44d22eee8032abb (patch)
tree7e1321d97907a4dcaae490a48b314442d2d5ce17 /vendor/github.com/Azure/go-ansiterm/winterm
parent331d4c5c78bacb559defcd981cf3fe653bedb4b2 (diff)
downloadpodman-69e327378f16a6abccc74191b44d22eee8032abb.tar.gz
podman-69e327378f16a6abccc74191b44d22eee8032abb.tar.bz2
podman-69e327378f16a6abccc74191b44d22eee8032abb.zip
Bump to Buildah v1.23.0
Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'vendor/github.com/Azure/go-ansiterm/winterm')
-rw-r--r--vendor/github.com/Azure/go-ansiterm/winterm/ansi.go24
1 files changed, 19 insertions, 5 deletions
diff --git a/vendor/github.com/Azure/go-ansiterm/winterm/ansi.go b/vendor/github.com/Azure/go-ansiterm/winterm/ansi.go
index a67327972..5599082ae 100644
--- a/vendor/github.com/Azure/go-ansiterm/winterm/ansi.go
+++ b/vendor/github.com/Azure/go-ansiterm/winterm/ansi.go
@@ -10,6 +10,7 @@ import (
"syscall"
"github.com/Azure/go-ansiterm"
+ windows "golang.org/x/sys/windows"
)
// Windows keyboard constants
@@ -162,15 +163,28 @@ func ensureInRange(n int16, min int16, max int16) int16 {
func GetStdFile(nFile int) (*os.File, uintptr) {
var file *os.File
- switch nFile {
- case syscall.STD_INPUT_HANDLE:
+
+ // syscall uses negative numbers
+ // windows package uses very big uint32
+ // Keep these switches split so we don't have to convert ints too much.
+ switch uint32(nFile) {
+ case windows.STD_INPUT_HANDLE:
file = os.Stdin
- case syscall.STD_OUTPUT_HANDLE:
+ case windows.STD_OUTPUT_HANDLE:
file = os.Stdout
- case syscall.STD_ERROR_HANDLE:
+ case windows.STD_ERROR_HANDLE:
file = os.Stderr
default:
- panic(fmt.Errorf("Invalid standard handle identifier: %v", nFile))
+ switch nFile {
+ case syscall.STD_INPUT_HANDLE:
+ file = os.Stdin
+ case syscall.STD_OUTPUT_HANDLE:
+ file = os.Stdout
+ case syscall.STD_ERROR_HANDLE:
+ file = os.Stderr
+ default:
+ panic(fmt.Errorf("Invalid standard handle identifier: %v", nFile))
+ }
}
fd, err := syscall.GetStdHandle(nFile)