mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-16 15:23:48 -05:00
Refactor tui.TtyIn()
This commit is contained in:
@@ -36,15 +36,8 @@ func ttyname() string {
|
||||
|
||||
// TtyIn returns terminal device to be used as STDIN, falls back to os.Stdin
|
||||
func TtyIn() *os.File {
|
||||
in, err := os.OpenFile(consoleDevice, syscall.O_RDONLY, 0)
|
||||
if err != nil {
|
||||
tty := ttyname()
|
||||
if len(tty) > 0 {
|
||||
if in, err := os.OpenFile(tty, syscall.O_RDONLY, 0); err == nil {
|
||||
return in
|
||||
}
|
||||
}
|
||||
return os.Stdin
|
||||
if in, err := openTtyIn(); err == nil {
|
||||
return in
|
||||
}
|
||||
return in
|
||||
return os.Stdin
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user