posix

package
v0.0.0-...-fd2add7 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package posix provides a few POSIX-based facilities for local and remote scripting

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadDir

func DownloadDir(remoteHost, remoteDir, sourceDir string) error

DownloadDir copies the contents of remoteDir on remoteHost to local directory sourceDir, using rsync over ssh.

func Exec

func Exec(prog, dir string, stdin string, argv ...string) (stdout, stderr string, err error)

Exec executes prog with working directory dir, flags argv, and standard input stdin. Exec returns the standard output and error streams as strings.

func ForwardCombined

func ForwardCombined(prefix string, stderr, stdout io.Reader)

func ForwardStderr

func ForwardStderr(prefix string, stderr io.Reader)

func PrintScript

func PrintScript(dir string, env Env, s string)

func RemoteShell

func RemoteShell(remoteHost, remoteShellStdin string) (stdout, stderr string, err error)

RemoteShell executes sh on remoteHost via ssh and feeds it remoteShellStdin on the standard input.

func Shell

func Shell(shellStdin string) (stdout, stderr string, err error)

Shell executes sh and feeds it standard input shellStdin.

func Shell2

func Shell2(env Env, dir, shellScript string, show bool) error

func UploadDir

func UploadDir(remoteHost, sourceDir, remoteDir string) error

UploadDir copies the contents of sourceDir recursively into remoteDir. remoteDir must be present on the remote host.

Types

type Env

type Env map[string]string

Env holds environment variables

func OSEnv

func OSEnv() Env

Rename to GetEnv

func (Env) Copy

func (env Env) Copy() Env

func (Env) Environ

func (env Env) Environ() []string

func (Env) Get

func (env Env) Get(key string) string

func (Env) Set

func (env Env) Set(key, value string)

func (Env) Unset

func (env Env) Unset(key string)

Jump to

Keyboard shortcuts

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