mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-17 10:35:28 -07:00
Fix Windows stuff related to the refactor at 49a5d16
This commit is contained in:
@@ -11,28 +11,19 @@ import (
|
||||
)
|
||||
|
||||
func (p *Program) initInput() error {
|
||||
if !p.inputIsTTY {
|
||||
return nil
|
||||
}
|
||||
|
||||
// If input's a TTY this should always succeed.
|
||||
f, ok := p.input.(*os.File)
|
||||
if !ok {
|
||||
return errInputIsNotAFile
|
||||
}
|
||||
|
||||
if p.inputStatus == managedInput {
|
||||
// If input's a file, use console to manage it
|
||||
if f, ok := p.input.(*os.File); ok {
|
||||
// Save a reference to the current stdin then replace stdin with our
|
||||
// input. We do this so we can hand input off to containerd/console to
|
||||
// set raw mode, and do it in this fashion because the method
|
||||
// console.ConsoleFromFile isn't supported on Windows.
|
||||
p.windowsStdin = os.Stdin
|
||||
os.Stdin = f
|
||||
}
|
||||
|
||||
// Note: this will panic if it fails.
|
||||
c := console.Current()
|
||||
p.console = c
|
||||
// Note: this will panic if it fails.
|
||||
c := console.Current()
|
||||
p.console = c
|
||||
}
|
||||
|
||||
enableAnsiColors(p.output)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user