mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-11-28 07:21:21 +08:00
a18aec1ac8
- Let file:is-tty always take one argument. - Revert change to eval.ByteOutput. - Make sys.IsATTY take a FD instead, to avoid the need to use os.NewFile. Using os.NewFile can cause the Go runtime to start polling the file, which interferes with Elvish's terminal reader.
27 lines
742 B
Go
27 lines
742 B
Go
// Package sys provide system utilities with the same API across OSes.
|
|
//
|
|
// The subpackages eunix and ewindows provide OS-specific utilities.
|
|
package sys
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/mattn/go-isatty"
|
|
)
|
|
|
|
const sigsChanBufferSize = 256
|
|
|
|
// NotifySignals returns a channel on which all signals gets delivered.
|
|
func NotifySignals() chan os.Signal { return notifySignals() }
|
|
|
|
// SIGWINCH is the window size change signal.
|
|
const SIGWINCH = sigWINCH
|
|
|
|
// Winsize queries the size of the terminal referenced by the given file.
|
|
func WinSize(file *os.File) (row, col int) { return winSize(file) }
|
|
|
|
// IsATTY determines whether the given file is a terminal.
|
|
func IsATTY(fd uintptr) bool {
|
|
return isatty.IsTerminal(fd) || isatty.IsCygwinTerminal(fd)
|
|
}
|