mirror of https://github.com/gdamore/tcell.git
Change to /dev/tty because term.GetState fails
The file descriptor of "os.Stdin" may cause term.GetState to be an error.
This commit is contained in:
parent
14c5375ccc
commit
7694d90821
|
@ -103,11 +103,14 @@ func (t *tScreen) disengage() {
|
|||
func (t *tScreen) initialize() error {
|
||||
var err error
|
||||
t.out = os.Stdout
|
||||
t.in = os.Stdin
|
||||
t.saved, err = term.GetState(int(os.Stdin.Fd()))
|
||||
if err != nil {
|
||||
if t.in, err = os.Open("/dev/tty"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
t.saved, err = term.GetState(int(t.in.Fd()))
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue