Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/term: The handle is invalid on windows #68187

Closed
FinecoFinit opened this issue Jun 26, 2024 · 2 comments
Closed

x/term: The handle is invalid on windows #68187

FinecoFinit opened this issue Jun 26, 2024 · 2 comments
Milestone

Comments

@FinecoFinit
Copy link

Go version

go version go1.22.3 windows/amd64

Output of go env in your module/workspace:

set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\magic\AppData\Local\go-build
set GOENV=C:\Users\magic\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\magic\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\magic\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.22.3
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=D:\goterpix\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\magic\AppData\Local\Temp\go-build3875495501=/tmp/go-build -gno-record-gcc-switches

What did you do?

go get golang.org/x/term

        terY, terX, err := term.GetSize(0)
	if err != nil {
		panic(err)
	}

run on powershell

What did you see happen?

panic: The handle is invalid.

goroutine 1 [running]:
main.main()
D:/goterpix/goterpix.go:54 +0xd8e
exit status 2

What did you expect to see?

Value given

@gopherbot gopherbot added this to the Unreleased milestone Jun 26, 2024
@seankhliao
Copy link
Member

I believe 0 is the incorrect file descriptor on windows.

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants