mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-11 15:34:56 +00:00
app/vmctl: follow up after aed59b9029
(#3983)
This commit is contained in:
parent
8ed9295109
commit
4ba237ec14
4 changed files with 19 additions and 9 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
8
app/vmctl/terminal/windows..go
Normal file
8
app/vmctl/terminal/windows..go
Normal file
|
@ -0,0 +1,8 @@
|
|||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package terminal
|
||||
|
||||
func isTerminal(fd int) bool {
|
||||
return true
|
||||
}
|
Loading…
Reference in a new issue