Skip to content

Commit

Permalink
Merge pull request #61 from tklauser/fix-solaris-isterminal
Browse files Browse the repository at this point in the history
Don't set termio in IsTerminal on solaris
  • Loading branch information
mattn committed May 26, 2021
2 parents 3751eb4 + 518b0c1 commit 8b0c6d8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions isatty_solaris.go
Expand Up @@ -8,10 +8,9 @@ import (
)

// IsTerminal returns true if the given file descriptor is a terminal.
// see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c
// see: https://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libc/port/gen/isatty.c
func IsTerminal(fd uintptr) bool {
var termio unix.Termio
err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio)
_, err := unix.IoctlGetTermio(int(fd), unix.TCGETA)
return err == nil
}

Expand Down

0 comments on commit 8b0c6d8

Please sign in to comment.