File: sys.go

package info (click to toggle)
elvish 0.21.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,372 kB
  • sloc: javascript: 236; sh: 130; python: 104; makefile: 88; xml: 9
file content (26 lines) | stat: -rw-r--r-- 742 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// 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)
}