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

cmd/go: cannot use 'go run' with code depending on TERM variable #11449

Closed
osocurioso opened this issue Jun 28, 2015 · 4 comments
Closed

cmd/go: cannot use 'go run' with code depending on TERM variable #11449

osocurioso opened this issue Jun 28, 2015 · 4 comments
Milestone

Comments

@osocurioso
Copy link
Contributor

Trying to 'go run' the demos from the github.com/nsf/termbox-go library panics because the 'dumb' terminal as set by $GOROOT/src/cmd/go/env.go is not recognized.

run-getenv$ uname -p -o -v -r
3.19.0-21-generic #21-Ubuntu SMP Sun Jun 14 18:31:11 UTC 2015 x86_64 GNU/Linux
run-getenv$ echo $TERM
xterm
run-getenv$ curl http://play.golang.org/p/miGq22cTZ_ > main.go
run-getenv$ go run main.go
dumb
run-getenv$ go build && ./run-getenv
xterm

I would expect 'xterm' to be output in both cases.

The override of the TERM environment variable was introduced in commit c485b58 to avoid escape codes from clang. Is this still necessary?

@gopherbot
Copy link

CL https://golang.org/cl/12483 mentions this issue.

@mikioh mikioh modified the milestones: Go1.5, Unplanned Jul 22, 2015
@ericwq
Copy link

ericwq commented Aug 10, 2015

$ uname -a
Darwin wangs-MacBook.local 14.4.0 Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
$ go version
go version go1.5rc1 darwin/amd64

if you run the following simple test

func TestTermEnv(t *testing.T) {
    fmt.Printf("%s\n",os.Getenv("TERM"))
}

the result will be:

$go test
dumb

@ianlancetaylor
Copy link
Contributor

@ericwq This issue was about "go run". Please open a separate issue for "go test". It's less clear what to do for that case, if anything. Thanks.

@gopherbot
Copy link

CL https://golang.org/cl/13449 mentions this issue.

rsc added a commit that referenced this issue Aug 11, 2015
Fixes #12096.
Followup to CL 12483, which fixed #11709 and #11449.

Change-Id: I9031ea36cc60685f4d6f65c39f770c89b3e3395a
Reviewed-on: https://go-review.googlesource.com/13449
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@golang golang locked and limited conversation to collaborators Aug 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants