aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/pprof
diff options
context:
space:
mode:
authorHana (Hyang-Ah) Kim <hyangah@gmail.com>2018-07-10 00:44:21 -0400
committerHyang-Ah Hana Kim <hyangah@gmail.com>2018-07-11 01:08:56 +0000
commit5e70b132c22d10e556b3840626a50ecf1dcad35f (patch)
tree2ff166b3b493dd4f648774ca8f76a9ad1c146e4e /src/cmd/pprof
parent8d6fc84986cc0cb0bf77503828a2e7740f8ccac1 (diff)
downloadgo-5e70b132c22d10e556b3840626a50ecf1dcad35f.tar.gz
go-5e70b132c22d10e556b3840626a50ecf1dcad35f.zip
cmd/pprof: disable readline UI support for TERM=dumb
In general, dumb terminal indicates terminal with limited capability. It may provide no support for special character sequences, e.g., no handling of ANSI escape sequences. Its input/output handling behavior may deviate from what's described in termios or terminfo. E.g., in the shell in emacs, even after successfully setting the terminal to raw mode, the terminal behaves as if it's still operating in canonical mode since emacs is doing input processing first. Readline support can be broken in various ways in dumb terminal mode, so we want to disable readline or advanced UI features. The easiest way to detect dumb terminal is to check the environment variable "TERM". Fixes #26254 Change-Id: I6b652eb555bc03b84405aae08b0b25d111fbb8b0 Reviewed-on: https://go-review.googlesource.com/122879 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/cmd/pprof')
-rw-r--r--src/cmd/pprof/readlineui.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/pprof/readlineui.go b/src/cmd/pprof/readlineui.go
index 6e91816f9b..bf2f321184 100644
--- a/src/cmd/pprof/readlineui.go
+++ b/src/cmd/pprof/readlineui.go
@@ -34,6 +34,10 @@ type readlineUI struct {
}
func newReadlineUI() driver.UI {
+ // disable readline UI in dumb terminal. (golang.org/issue/26254)
+ if v := strings.ToLower(os.Getenv("TERM")); v == "" || v == "dumb" {
+ return nil
+ }
// test if we can use terminal.ReadLine
// that assumes operation in the raw mode.
oldState, err := terminal.MakeRaw(0)