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: git-bash.exe reports stdout is not a terminal. #46681

Closed
gabyx opened this issue Jun 10, 2021 · 8 comments
Closed

x/term: git-bash.exe reports stdout is not a terminal. #46681

gabyx opened this issue Jun 10, 2021 · 8 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@gabyx
Copy link

gabyx commented Jun 10, 2021

What version of Go are you using (go version)?

1.16

Does this issue reproduce with the latest release?

yes (v0.0.0-20210503060354-a79de5458b56)

What operating system and processor architecture are you using (go env)?

Windows 10

go env Output
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\gabriel.nuetzi\AppData\Local\go-build
set GOENV=C:\Users\gabriel.nuetzi\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\gabriel.nuetzi\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\gabriel.nuetzi\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.16
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=F:\Repositories\githooks\githooks\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\GABRIE~1.NUE\AppData\Local\Temp\go-build1896432741=/tmp/go-build -gno-record-gcc-switches

What did you do?

package main

import (
	"fmt"
	"os"

	"golang.org/x/term"
)


func main() {
	fmt.Print(term.IsTerminal(int(os.Stdout.Fd())))
}
  1. Open "git-bash.exe" (from git-for-windows) -> go run main.go
  2. Open VS Code -> Open Integrated Terminal (bash.exe from git-for-windows) -> go run main.go

What did you expect to see?

  1. Output: "true"
  2. Output: "true"

What did you see instead?

  1. Output: "false" (wrong?)
  2. Output: "true" (correct)

@mattn: The package isatty has the exact same issue altough working differently:
fmt.Print(isatty.IsTerminal(os.Stdout.Fd()))

@gopherbot gopherbot added this to the Unreleased milestone Jun 10, 2021
@gabyx
Copy link
Author

gabyx commented Jun 10, 2021

I am most interested why this bahvior is happening...

@gabyx
Copy link
Author

gabyx commented Jun 10, 2021

git-bash.exe as far as I know is a MSYS2 Bash.

@gabyx
Copy link
Author

gabyx commented Jun 10, 2021

Since most Windows user use this bash, thats why I report it. Powershell is not an option, its a shitshow...

@seankhliao
Copy link
Member

I believe this has the same cause as #11914 (comment) (which is to say there's nothing we can do)

@cherrymui cherrymui added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 11, 2021
@cherrymui
Copy link
Member

As this is Go issue tracker, it is probably not relevant to discuss the quality of various shells. Please bear in mind our Gopher values and keep the feedback constructive. Thanks.

@gabyx
Copy link
Author

gabyx commented Jun 11, 2021

Its a shell issue, I close this.

@gabyx gabyx closed this as completed Jun 11, 2021
@golang golang locked and limited conversation to collaborators Jun 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants
@gabyx @gopherbot @seankhliao @cherrymui and others