app/vmctl: follow up after aed59b9029 (#3983)

This commit is contained in:
Dmytro Kozlov 2023-03-21 16:53:53 +02:00 committed by GitHub
parent 6a78755b66
commit f0b09a1382
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 9 deletions

View File

@ -1,14 +1,6 @@
//go:build darwin || linux || solaris
// +build darwin linux solaris
package terminal
import (
"golang.org/x/sys/unix"
)
// IsTerminal returns true if the file descriptor is terminal
func IsTerminal(fd int) bool {
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
return err == nil
return isTerminal(fd)
}

View File

@ -6,3 +6,8 @@ package terminal
import "golang.org/x/sys/unix"
const ioctlReadTermios = unix.TCGETS
func isTerminal(fd int) bool {
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
return err == nil
}

View File

@ -6,3 +6,8 @@ package terminal
import "golang.org/x/sys/unix"
const ioctlReadTermios = unix.TIOCGETA
func isTerminal(fd int) bool {
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
return err == nil
}

View File

@ -0,0 +1,8 @@
//go:build windows
// +build windows
package terminal
func isTerminal(fd int) bool {
return true
}