| 1 | package cmdenv |
| 2 | |
| 3 | import ( |
| 4 | "os" |
| 5 | |
| 6 | "github.com/mattn/go-isatty" |
| 7 | ) |
| 8 | |
| 9 | // IsTerminal reports whether f is connected to a terminal, |
| 10 | // including MSYS/Cygwin-style terminals on Windows. |
| 11 | func IsTerminal(f *os.File) bool { |
| 12 | fd := f.Fd() |
| 13 | return isatty.IsTerminal(fd) || isatty.IsCygwinTerminal(fd) |
| 14 | } |