osadapter

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	OSExecCommand
	GetPath() string
	GetDir() string
	GetArgs() []string
	String() string
}

type File

type File interface {
	Chdir() error
	Chmod(mode os.FileMode) error
	Chown(uid, gid int) error
	Close() error
	Fd() uintptr
	Name() string
	Read(b []byte) (n int, err error)
	ReadAt(b []byte, off int64) (n int, err error)
	Readdir(n int) ([]os.FileInfo, error)
	Readdirnames(n int) (names []string, err error)
	Seek(offset int64, whence int) (ret int64, err error)
	Stat() (os.FileInfo, error)
	Sync() error
	Truncate(size int64) error
	Write(b []byte) (n int, err error)
	WriteAt(b []byte, off int64) (n int, err error)
	WriteString(s string) (n int, err error)
}

type OS

type OS interface {
	Command(cmd string, args ...string) Command
	LookPath(file string) (string, error)
	TempFile(dir, prefix string) (f File, err error)
	Copy(dst io.Writer, src io.Reader) (written int64, err error)
	Walk(path string, f filepath.WalkFunc) error
	Getwd() (string, error)
}

OS is our indirection of the pieces from os and os/exec that we use, so we can mock those functions in our tests.

func RealOS

func RealOS() OS

RealOS returns an OS that is backed by the os- and sub-package.

type OSExecCommand

type OSExecCommand interface {
	CombinedOutput() ([]byte, error)
	Output() ([]byte, error)
	Run() error
	Start() error
	StderrPipe() (io.ReadCloser, error)
	StdinPipe() (io.WriteCloser, error)
	StdoutPipe() (io.ReadCloser, error)
	Wait() error
}

OSExecCommand is the interface wrapping all functions on exec.Cmd

Jump to

Keyboard shortcuts

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