Go version

go version go1.25.1 freebsd/amd64

Output of go env in your module/workspace:

AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/marcus/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/marcus/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4154226314=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='freebsd'
GOINSECURE=''
GOMOD='/home/marcus/go/src/git.fractalqb.de/fractalqb/tiktak/go.mod'
GOMODCACHE='/home/marcus/go/pkg/mod'
GONOPROXY='git.home.fractalqb.de'
GONOSUMDB='git.home.fractalqb.de'
GOOS='freebsd'
GOPATH='/home/marcus/go'
GOPRIVATE='git.home.fractalqb.de'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/marcus/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/freebsd_amd64'
GOVCS=''
GOVERSION='go1.25.1'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

Is used term.IsTerminal(int(os.Stdin.Fd())) on FreeBSD and noticed that it does not work as expected. After some research if found that the reason is the wrong values passed to ioctl. Copying code and doing the replacements as noticed in ticket's title fixed the problem.

What did you see happen?

Running a test program that does only call IsTerminal on stdin file descriptor like echo "x" | testprog shows false on Linux but shows true on FreeBSD.

What did you expect to see?

I expected to see same behavior on Linux and FreeBSD.

Comment From: gabyhelp

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)