From 1ef7d85db5b0ce2ff6a9f0a66ed9cc27de5a5d1b Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Sun, 16 Feb 2025 17:28:10 +0100 Subject: [PATCH] Added FreeBSD support --- tty/{Terminal_darwin.go => Terminal_bsd.go} | 2 ++ tty/Terminal_linux.go | 2 ++ tty/Terminal_other.go | 8 ++++++++ tty/Terminal_windows.go | 2 ++ 4 files changed, 14 insertions(+) rename tty/{Terminal_darwin.go => Terminal_bsd.go} (88%) create mode 100644 tty/Terminal_other.go diff --git a/tty/Terminal_darwin.go b/tty/Terminal_bsd.go similarity index 88% rename from tty/Terminal_darwin.go rename to tty/Terminal_bsd.go index 0726279..15e06e0 100644 --- a/tty/Terminal_darwin.go +++ b/tty/Terminal_bsd.go @@ -1,3 +1,5 @@ +//go:build darwin || freebsd + package tty import "golang.org/x/sys/unix" diff --git a/tty/Terminal_linux.go b/tty/Terminal_linux.go index 4e44a64..023c564 100644 --- a/tty/Terminal_linux.go +++ b/tty/Terminal_linux.go @@ -1,3 +1,5 @@ +//go:build linux + package tty import "golang.org/x/sys/unix" diff --git a/tty/Terminal_other.go b/tty/Terminal_other.go new file mode 100644 index 0000000..3ea5ee8 --- /dev/null +++ b/tty/Terminal_other.go @@ -0,0 +1,8 @@ +//go:build !darwin && !freebsd && !linux && !windows + +package tty + +// IsTerminal is always false on unsupported platforms. +func IsTerminal(fd uintptr) bool { + return false +} diff --git a/tty/Terminal_windows.go b/tty/Terminal_windows.go index c7355d1..0bf1927 100644 --- a/tty/Terminal_windows.go +++ b/tty/Terminal_windows.go @@ -1,3 +1,5 @@ +//go:build windows + package tty import "golang.org/x/sys/windows"