exe

package
v0.0.0-...-eb599cc Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SSHClient

func SSHClient(username, host string) (*ssh.Client, error)

SSHClient returns an SSH client for the given username@host. It assumes ssh-agent will be available for key authentication.

Types

type Cmd

type Cmd struct {
	*exec.Cmd
	PseudoTTY bool
	Input     string
}

Cmd represents an external command being prepared or run.

func Command

func Command(name string, args ...string) *Cmd

Command returns a new Cmd.

func (*Cmd) Dir

func (c *Cmd) Dir(dir string) *Cmd

Dir is a fluent setter for the directory option.

func (*Cmd) Env

func (c *Cmd) Env(env []string) *Cmd

Env is a fluent setter for the env option. Elements should be of the form NAME=value.

func (*Cmd) Run

func (c *Cmd) Run() *Result

Run runs the command and returns a Result

func (*Cmd) SetInput

func (c *Cmd) SetInput(input string) *Cmd

SetInput is a fluent setter for the input option.

func (*Cmd) SetPseudoTTY

func (c *Cmd) SetPseudoTTY() *Cmd

SetPseudoTTY is a fluent setter for the pty option.

type RemoteCmd

type RemoteCmd struct {
	Cmd       string
	PseudoTTY bool
}

RemoteCmd is a command that is executed over SSH

func RemoteCommand

func RemoteCommand(name string, args ...string) *RemoteCmd

RemoteCommand creates a new remote command. You can specify the whole command as a single string, or as separate arguments that get joined by spaces.

func (*RemoteCmd) RequestPseudoTTY

func (c *RemoteCmd) RequestPseudoTTY() *RemoteCmd

RequestPseudoTTY will force the command to request a pty on the remote server.

func (*RemoteCmd) Run

func (c *RemoteCmd) Run(client *ssh.Client) Result

Run executes the command using the given SSH client

type Result

type Result struct {
	Err    error
	Stdout string
	Stderr string
}

Result represents the outcome of running a command.

Jump to

Keyboard shortcuts

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