File: terminal.go

package info (click to toggle)
golang-github-hlandau-xlog 1.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 120 kB
  • sloc: makefile: 2
file content (17 lines) | stat: -rw-r--r-- 265 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// +build darwin freebsd openbsd netbsd linux windows

package xlog

import "io"
import "github.com/mattn/go-isatty"

func isTerminal(w io.Writer) bool {
	wf, ok := w.(interface {
		Fd() uintptr
	})
	if !ok {
		return false
	}

	return isatty.IsTerminal(wf.Fd())
}