diff options
author | Felix Lange <fjl@twurst.com> | 2016-11-04 02:51:19 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2016-11-04 02:51:19 +0800 |
commit | ac9013162e51aad9525fcac084973a0cfbc1575a (patch) | |
tree | 54c6f2480cbb23a18c81e367b3c89b8aaead86c2 /vendor/github.com/peterh/liner/input.go | |
parent | ed2bc7fbe9a30c1861cffdd7d0fd570847a2ae0c (diff) | |
download | dexon-ac9013162e51aad9525fcac084973a0cfbc1575a.tar dexon-ac9013162e51aad9525fcac084973a0cfbc1575a.tar.gz dexon-ac9013162e51aad9525fcac084973a0cfbc1575a.tar.bz2 dexon-ac9013162e51aad9525fcac084973a0cfbc1575a.tar.lz dexon-ac9013162e51aad9525fcac084973a0cfbc1575a.tar.xz dexon-ac9013162e51aad9525fcac084973a0cfbc1575a.tar.zst dexon-ac9013162e51aad9525fcac084973a0cfbc1575a.zip |
vendor: update github.com/peterh/liner
Diffstat (limited to 'vendor/github.com/peterh/liner/input.go')
-rw-r--r-- | vendor/github.com/peterh/liner/input.go | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/vendor/github.com/peterh/liner/input.go b/vendor/github.com/peterh/liner/input.go index 0ee6be7af..904fbf663 100644 --- a/vendor/github.com/peterh/liner/input.go +++ b/vendor/github.com/peterh/liner/input.go @@ -31,11 +31,6 @@ type State struct { // NewLiner initializes a new *State, and sets the terminal into raw mode. To // restore the terminal to its previous state, call State.Close(). -// -// Note if you are still using Go 1.0: NewLiner handles SIGWINCH, so it will -// leak a channel every time you call it. Therefore, it is recommened that you -// upgrade to a newer release of Go, or ensure that NewLiner is only called -// once. func NewLiner() *State { var s State s.r = bufio.NewReader(os.Stdin) @@ -87,8 +82,12 @@ func (s *State) startPrompt() { s.restartPrompt() } +func (s *State) inputWaiting() bool { + return len(s.next) > 0 +} + func (s *State) restartPrompt() { - next := make(chan nexter) + next := make(chan nexter, 200) go func() { for { var n nexter @@ -126,8 +125,6 @@ func (s *State) nextPending(timeout <-chan time.Time) (rune, error) { s.pending = s.pending[1:] return rv, errTimedOut } - // not reached - return 0, nil } func (s *State) readNext() (interface{}, error) { @@ -349,7 +346,7 @@ func (s *State) readNext() (interface{}, error) { // Close returns the terminal to its previous mode func (s *State) Close() error { - stopSignal(s.winch) + signal.Stop(s.winch) if !s.inputRedirected { s.origMode.ApplyMode() } |