pty

package
v0.0.0-...-97c4edd Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(shell string) (*os.File, error)

Start starts and returns an open PTY session with the given shell command.

func Verify

func Verify(shell string) error

Verify verifies the given shell command, returning an error if invalid.

Types

type BaseSession

type BaseSession interface {
	SessionID() string
	Session() *os.File
	Out() *broadcast.Broadcaster
	Execute(string) error
	Close()
}

BaseSession allows communcation with a PTY session.

type Session

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

Session is a PTY that allows command execution through Session.Execute while sending output through the Session.Out channel.

func CreateSession

func CreateSession(sessionID, shell string) (*Session, error)

CreateSession creates a new Session injected with the given sessionID, the given shell and defaults.

func (*Session) Close

func (ptySession *Session) Close()

Close schedules the session for closure

func (*Session) Execute

func (ptySession *Session) Execute(toBeExecuted string) error

Execute executes toBeExecuted in the pty. Output is written to Session.Out.

func (*Session) Out

func (ptySession *Session) Out() *broadcast.Broadcaster

Out returns a broadcaster used for communicating output to command execution in the PTY.

func (*Session) Session

func (ptySession *Session) Session() *os.File

Session returns the inner pty.

func (*Session) SessionID

func (ptySession *Session) SessionID() string

SessionID returns the sessionID

Jump to

Keyboard shortcuts

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