File: isatty_enabled.go

package info (click to toggle)
git-sizer 1.3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 300 kB
  • sloc: sh: 98; makefile: 80
file content (21 lines) | stat: -rw-r--r-- 283 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// +build isatty

package isatty

/*
#include <stdlib.h>
#include <unistd.h>
*/
import "C"

import (
	"syscall"
)

func Isatty(fd uintptr) (bool, error) {
	result, err := C.isatty(C.int(fd))
	if err != nil && err != syscall.EINVAL {
		return false, err
	}
	return result != 0, nil
}