shellclient

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2017 License: MPL-2.0 Imports: 13 Imported by: 2 modules, 1 package

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

Overview

Package shellclient provides a wrapper for demuxing a shell websocket and exposing the stdout/stderr streams as well as offering a way to provide the stdin stream.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ShellClient

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

ShellClient exposes the client interface to a shell running remotely. This object implements the engines.Shell interface.

func Dial

func Dial(socketURL string, command []string, tty bool) (*ShellClient, error)

Dial will open a websocket to socketURL giving command and tty to the server. If no command is given the server should open its default shell in a human usable configuration.

func New

func New(ws *websocket.Conn) *ShellClient

New takes a websocket and creates a ShellClient object implementing the engines.Shell interface.

func (*ShellClient) Abort

func (s *ShellClient) Abort() error

Abort will tell the remote shell to abort and close the websocket.

func (*ShellClient) SetSize

func (s *ShellClient) SetSize(columns, rows uint16) error

SetSize will attempt to set the TTY width (columns) and height (rows) on the remote shell.

func (*ShellClient) StderrPipe

func (s *ShellClient) StderrPipe() io.ReadCloser

StderrPipe returns a pipe from which stderr must be read. It's important to drain this pipe or the shell will block when the internal buffer is full.

func (*ShellClient) StdinPipe

func (s *ShellClient) StdinPipe() io.WriteCloser

StdinPipe returns a pipe to which stdin must be written. It's important to close stdin, if you expect the remote shell to terminate.

func (*ShellClient) StdoutPipe

func (s *ShellClient) StdoutPipe() io.ReadCloser

StdoutPipe returns a pipe from which stdout must be read. It's important to drain this pipe or the shell will block when the internal buffer is full.

func (*ShellClient) Wait

func (s *ShellClient) Wait() (bool, error)

Wait will wait for the remote shell to finish, by either succeeding or returning an error.

Jump to

Keyboard shortcuts

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