Documentation ¶
Overview ¶
Some file descriptor manipulation funcs (Unix-Only), inspired by https://github.com/skarnet/execline/blob/master/src/execline/redirfd.c
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileDescriptor ¶
type FileDescriptor int
FileDescriptor mirrors unix-specific indexes for cross-platform use
const ( InvalidFD FileDescriptor = -1 Stdin FileDescriptor = 0 Stdout FileDescriptor = 1 Stderr FileDescriptor = 2 )
func ParseFileDescriptor ¶
func ParseFileDescriptor(fdstr string) (FileDescriptor, error)
ParseFileDescriptor parses a string formatted file descriptor
type RedirectMode ¶
type RedirectMode int
const ( Read RedirectMode = iota // open file for reading Write // open file for writing, truncating if it exists Update // open file for read & write Append // open file for append, create if it does not exist AppendExisting // open file for append, do not create if it does not already exist WriteNew // open file for writing, creating it, failing if it already exists )
func (RedirectMode) Redirect ¶
func (mode RedirectMode) Redirect(nonblock, changemode bool, fd FileDescriptor, name string) (*os.File, error)
see https://github.com/skarnet/execline/blob/master/src/execline/redirfd.c
Click to show internal directories.
Click to hide internal directories.