mirror of
https://github.com/golang/term.git
synced 2026-01-29 07:02:06 +03:00
Extracted from golang.org/x/crypto/ssh/terminal The implementation for plan9 is based on IsTerminal from github.com/mattn/go-isatty Change-Id: Id7bf2d6595639ff08e5fd5f786a145d340bbed08 Reviewed-on: https://go-review.googlesource.com/c/term/+/200681 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
18 lines
372 B
Go
18 lines
372 B
Go
// Copyright 2019 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package term
|
|
|
|
import (
|
|
"golang.org/x/sys/plan9"
|
|
)
|
|
|
|
func isTerminal(fd int) bool {
|
|
path, err := plan9.Fd2path(fd)
|
|
if err != nil {
|
|
return false
|
|
}
|
|
return path == "/dev/cons" || path == "/mnt/term/dev/cons"
|
|
}
|