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

This commit is contained in:
Dmytro Kozlov 2023-03-21 16:53:53 +02:00 committed by Aliaksandr Valialkin
parent 8ed9295109
commit 4ba237ec14
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1
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
}