Skip to content
Myr

Revert "Close handles to /dev/tty", instead reuse handles

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 218843b · Browse files · 1 file+22 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+22 added−5 removed

  • other:+22 added−5 removed

1 file+22 added−5 removed

modified:src/tui/light_unix.go+22 added-5 removed
12 unmodified lines
13 "golang.org/x/sys/unix"14 "golang.org/x/term"15)1617var tty string17var (18 tty string19 ttyin *os.File20 ttyout *os.File21)2223func IsLightRendererSupported() bool {24 return true25}
24 unmodified lines
50 return nil51}5253func (r *LightRenderer) closePlatform() {50 r.ttyin.Close()51 r.ttyout.Close()54 // NOOP55}5657func openTty(mode int) (*os.File, error) {58 in, err := os.OpenFile(consoleDevice, mode, 0)
11 unmodified lines
70 return in, nil71}7273func openTtyIn() (*os.File, error) {74 if ttyin != nil {75 return ttyin, nil76 }71 return openTty(syscall.O_RDONLY)77 in, err := openTty(syscall.O_RDONLY)78 if err == nil {79 ttyin = in80 }81 return in, err82}8384func openTtyOut() (*os.File, error) {85 if ttyout != nil {86 return ttyout, nil87 }75 return openTty(syscall.O_WRONLY)88 out, err := openTty(syscall.O_WRONLY)89 if err == nil {90 ttyout = out91 }92 return out, err93}9495func (r *LightRenderer) setupTerminal() {96 term.MakeRaw(r.fd())
57 unmodified lines