mirror of
https://github.com/golang/go
synced 2024-11-19 09:44:46 -07:00
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>
This commit is contained in:
parent
8d6fc84986
commit
5e70b132c2
@ -34,6 +34,10 @@ type readlineUI struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newReadlineUI() driver.UI {
|
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
|
// test if we can use terminal.ReadLine
|
||||||
// that assumes operation in the raw mode.
|
// that assumes operation in the raw mode.
|
||||||
oldState, err := terminal.MakeRaw(0)
|
oldState, err := terminal.MakeRaw(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user