sshpiper/cmd/sshpiperd/internal/plugin/tty.go
Josh Bleecher Snyder 89ab72bee0
all: run gofumpt (#652)
* all: run gofumpt

https://github.com/mvdan/gofumpt

The main appeal for me here is that my (and many other peoples')
editors run this on save, so doing a single diff here
keeps other diffs minimal.

* .github/workflows: add gofumpt checker
2025-08-29 20:04:31 -07:00

18 lines
287 B
Go

package plugin
import (
"io"
"os"
"golang.org/x/term"
)
// checkIfTerminal returns whether the given file descriptor is a terminal.
func checkIfTerminal(w io.Writer) bool {
switch v := w.(type) {
case *os.File:
return term.IsTerminal(int(v.Fd()))
default:
return false
}
}