redirfd

package
v1.0.8-beta Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2015 License: Apache-2.0 Imports: 4 Imported by: 0

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

Jump to

Keyboard shortcuts

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