Read input regardless of whether or not it's a TTY

This commit also contains some refactors:

* Refactor away inputStatus type
* Refactor away program.inputIsTTY member
* Simplify how we setup and restore input when it's a TTY
This commit is contained in:
Christian Rocha
2021-07-29 16:47:13 -04:00
parent 9826251f08
commit 9f9b3aea96
5 changed files with 32 additions and 83 deletions

View File

@@ -47,6 +47,7 @@ func (p *Program) restoreInput() error {
return nil
}
// Open the Windows equivalent of a TTY.
func openInputTTY() (*os.File, error) {
f, err := os.OpenFile("CONIN$", os.O_RDWR, 0644)
if err != nil {