Documentation
¶
Overview ¶
Package session carries a session between the host and the VM over SSH, on a terminal or without one. The guest serves the session, the host attaches to it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
In io.Reader
Out io.Writer
Term string
Size Size
Resized <-chan Size
// Env are variables for the command, as NAME=value.
Env []string
// OnPaste is called each time the person presses Ctrl+V, or is nil.
OnPaste func()
}
Client is the terminal on the host that attaches to a session. Resized delivers the new size whenever the terminal changes size, and may be nil.
type Exec ¶ added in v1.2.0
type Exec struct {
In io.Reader
Out io.Writer
Errors io.Writer
// Env are variables for the command, as NAME=value.
Env []string
}
Exec is a session without a terminal. The command reads In until it ends, a nil In sends nothing, and what the command prints goes to Out and, for standard error, to Errors. In may still be read after Run returned, until it ends or a read fails, so it must not be used for anything else.
type PTY ¶
PTY is a pseudo terminal. Master is the side a session reads and writes, Slave is the terminal of the command.
type Piped ¶ added in v1.2.0
Piped is a Process without a terminal. Stderr is what it prints to standard error, which the session keeps apart from the rest. CloseInput ends what it reads once the client has sent everything.
type Process ¶
type Process interface {
io.ReadWriteCloser
Resize(size Size) error
Wait() (exitCode int, err error)
}
Process is a command running on a terminal or on pipes. Reads return what it prints and writes type into it. Close releases the terminal or the pipes after Wait.
type Request ¶
Request is what a client asked for: whether it wants a terminal, the TERM and the size of that terminal, and the variables it sent, as NAME=value.