feat(logging): add interactive shell detection for console output

This commit is contained in:
Sergey Krashevich
2024-05-28 09:10:32 +03:00
parent 8e571a66e3
commit a79061c7c2
3 changed files with 19 additions and 1 deletions
+7
View File
@@ -0,0 +1,7 @@
//go:build !unix
package shell
func IsInteractive(fd uintptr) bool {
return false
}
+10
View File
@@ -0,0 +1,10 @@
//go:build unix
package shell
import "golang.org/x/sys/unix"
func IsInteractive(fd uintptr) bool {
_, err := unix.IoctlGetTermios(int(fd), unix.TIOCGETA)
return err == nil
}