inIsTTY reports whether the supplied reader is a *os.File backed by a terminal. Tests using bytes.Buffer return false, which is what we want so the buffer-driven test path doesn't block on a confirmation prompt.
(in io.Reader)
| 635 | // terminal. Tests using bytes.Buffer return false, which is what we want |
| 636 | // so the buffer-driven test path doesn't block on a confirmation prompt. |
| 637 | func inIsTTY(in io.Reader) bool { |
| 638 | file, ok := in.(*os.File) |
| 639 | if !ok { |
| 640 | return false |
| 641 | } |
| 642 | info, err := file.Stat() |
| 643 | if err != nil { |
| 644 | return false |
| 645 | } |
| 646 | return info.Mode()&os.ModeCharDevice != 0 |
| 647 | } |
| 648 | |
| 649 | // readLine reads up to a newline from in. Used only on the interactive |
| 650 | // confirmation path; bounded read so we don't hang on a closed stdin. |
no outgoing calls
no test coverage detected