osexec

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package osexec provides SystemExecConfig.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SystemExecConfig

type SystemExecConfig struct {
	// Shell is the shell to use for the server
	// This is called like `shell -c "command"“ when an ssh command is provided or like `shell` when not.
	// The shell is passed to exec.LookPath().
	Shell string
}

SystemExecConfig implements a proxyssh.Configuration and proxyssh.Handler that execute user processes using the real system.

func (*SystemExecConfig) Apply

func (cfg *SystemExecConfig) Apply(logger logging.Logger, sshserver *ssh.Server) error

Apply applies this configuration to the server. This is a no-op.

func (*SystemExecConfig) Handle

func (cfg *SystemExecConfig) Handle(logger logging.Logger, session ssh.Session) (proxyssh.Process, error)

Handle handles a new configuration thingy

func (*SystemExecConfig) RegisterFlags

func (cfg *SystemExecConfig) RegisterFlags(flagset *flag.FlagSet)

RegisterFlags registers flags representing the config to the provided flagset. When flagset is nil, uses flag.CommandLine.

type SystemProcess

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

SystemProcess represents a process that is run using a the shell on the current machine

func NewSystemProcess

func NewSystemProcess(command string, args []string) *SystemProcess

NewSystemProcess creates a new system process

func (*SystemProcess) Cleanup

func (sp *SystemProcess) Cleanup() (killed bool)

Cleanup cleans up this process, typically killing it

func (*SystemProcess) Init

func (sp *SystemProcess) Init(ctx context.Context, detector logging.MemoryLeakDetector, isPty bool) error

Init initializes this process

func (*SystemProcess) Start

func (sp *SystemProcess) Start(detector logging.MemoryLeakDetector, Term string, resizeChan <-chan proxyssh.WindowSize, isPty bool) (*os.File, error)

Start starts this process

func (*SystemProcess) Stderr

func (sp *SystemProcess) Stderr() (io.ReadCloser, error)

Stderr returns a pipe to Stderr

func (*SystemProcess) Stdin

func (sp *SystemProcess) Stdin() (io.WriteCloser, error)

Stdin returns a pipe to Stdin

func (*SystemProcess) Stdout

func (sp *SystemProcess) Stdout() (io.ReadCloser, error)

Stdout returns a pipe to Stdout

func (*SystemProcess) String

func (sp *SystemProcess) String() string

String turns ShellProcess into a string

func (*SystemProcess) Wait

func (sp *SystemProcess) Wait(detector logging.MemoryLeakDetector) (code int, err error)

Wait waits for the process and returns the exit code

Jump to

Keyboard shortcuts

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