command

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: BSD-3-Clause Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, sess RemoteSession, name string, options ...Option) (*Command, error)

Create a command executor Note: this will close the session after execution

func (*Command) CombinedOutput

func (c *Command) CombinedOutput() ([]byte, error)

func (*Command) Output

func (c *Command) Output() ([]byte, error)

func (*Command) Run

func (c *Command) Run() error

func (*Command) Start

func (c *Command) Start() error

func (*Command) StderrPipe

func (c *Command) StderrPipe() (io.Reader, error)

func (*Command) StdinPipe

func (c *Command) StdinPipe() (io.WriteCloser, error)

func (*Command) StdoutPipe

func (c *Command) StdoutPipe() (io.Reader, error)

func (*Command) String

func (c *Command) String() string

func (*Command) Wait

func (c *Command) Wait() error

type Option

type Option func(c *Command) error

func Args

func Args(args ...string) Option

func Env

func Env(name, value string) Option

func Shell

func Shell() Option

starts a login shell

type RemoteSession

type RemoteSession interface {
	Close() error
	CombinedOutput(cmd string) ([]byte, error)
	Output(cmd string) ([]byte, error)
	Run(cmd string) error
	Setenv(name string, value string) error
	Shell() error
	Signal(sig ssh.Signal) error
	Start(cmd string) error
	StderrPipe() (io.Reader, error)
	StdinPipe() (io.WriteCloser, error)
	StdoutPipe() (io.Reader, error)
	Wait() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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