os

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2016 License: BSD-2-Clause, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(path string) bool

Exists checks if a given filepath exists. Note that it's usually better to just use os.Open/1 when interacting with the file to avoid race-conditions.

func IsStdinPiped

func IsStdinPiped() bool

IsStdinPiped checks if data is being piped to os.Stdin or if os.Stdin is from a terminal.

func IsStdinReadable

func IsStdinReadable() bool

IsStdinReadable checks if os.Stdin is open for reading in a blocking way.

func IsStdinTerminal

func IsStdinTerminal() bool

IsStdinTerminal returns true if stdin is a terminal.

func IsTerminal

func IsTerminal(fd uintptr) bool

IsTerminal returns true if the given file descriptor is a terminal.

func LogCloseError

func LogCloseError(doClose func() error, fmtString ...string)

LogCloseError is a helper function which logs close errors. Useful in defers. Optionally accepts a format string. e.g, defer LogCloseError(fd.Close, "Failed to close fd")

func WaitForSignals

func WaitForSignals(handler func(os.Signal) bool)

WaitForSignals listens looping for syscall signals until the given signal handler returns true. Common uses are CTRL-T, CTRL-C, CTRL-D, CTRL-Z.

Note SIGQUIT (CTRL-\) is not handle on purpose to not accidentally override Go's stacktracing.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL