isInteractive returns true if stdin is a TTY (interactive terminal).
(stdin io.Reader)
| 1985 | |
| 1986 | // isInteractive returns true if stdin is a TTY (interactive terminal). |
| 1987 | func isInteractive(stdin io.Reader) bool { |
| 1988 | file, ok := stdin.(*os.File) |
| 1989 | if !ok { |
| 1990 | return false |
| 1991 | } |
| 1992 | fi, err := file.Stat() |
| 1993 | if err != nil { |
| 1994 | return false |
| 1995 | } |
| 1996 | return fi.Mode()&os.ModeCharDevice != 0 |
| 1997 | } |
| 1998 | |
| 1999 | // confirmOverwrite asks the user whether to overwrite an already-installed |
| 2000 | // entity. Returns true if the user confirms. Only called in interactive mode. |
no outgoing calls
no test coverage detected