~rockorager/mjmap

e10d61770e90503bec1dfdd9ab312e3b01885277 — Tim Culverhouse 1 year, 1 month ago dc07204
log: remove unix constants

Some of the unix constants are behind build flags. Hard code these,
worst case we fall back to no colorful logging.

Reported-by: Ben Cohen <ben@bencohen.net>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
1 files changed, 4 insertions(+), 3 deletions(-)

M log/log.go
M log/log.go => log/log.go +4 -3
@@ 80,10 80,12 @@ func SetOutput(w io.Writer) {
		_, err := unix.IoctlGetTermios(fd, tiocgeta)
		l.tty = (err == nil)
	case "linux", "aix":
		_, err := unix.IoctlGetTermios(fd, unix.TCGETS)
		var tcgets uint = 21505
		_, err := unix.IoctlGetTermios(fd, tcgets)
		l.tty = (err == nil)
	case "solaris":
		_, err := unix.IoctlGetTermios(fd, unix.TCGETA)
		var tcgeta uint = 21509
		_, err := unix.IoctlGetTermios(fd, tcgeta)
		l.tty = (err == nil)
	default:
		l.tty = false


@@ 224,4 226,3 @@ func Fatalf(format string, args ...any) {
	}
	l.l.Fatalf(prefix+format, args...)
}