Documentation
¶
Overview ¶
Package remote runs commands on hosts over ssh: to their end, as a stream of lines, or with the user's terminal.
Index ¶
- func Clean(s string) string
- func Command(ctx context.Context, h inventory.Host, tty bool, cmd string) *exec.Cmd
- func Interactive(ctx context.Context, h inventory.Host, cmd string) *exec.Cmd
- func Run(ctx context.Context, h inventory.Host, cmd string) (string, error)
- func Share(ctx context.Context, hosts []inventory.Host) []inventory.Host
- func Stream(ctx context.Context, h inventory.Host, cmd string, tty bool) <-chan string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clean ¶
Clean makes remote text plain: it drops escape sequences, then any other control character but tabs and newlines.
func Command ¶
Command is ssh running cmd on h, or with cmd "", a login shell. It never prompts, and gives up on dead hosts and dead connections quickly. tty gives the remote command a terminal, so that it's hung up when ssh ends (needed to stop a followed log).
func Interactive ¶
Interactive is ssh running cmd on h with the user's terminal, or with cmd "", a login shell. The caller hands it the terminal.
func Run ¶
Run runs cmd on h to its end, without a time limit, and returns its output, stdout and stderr, without control characters. Without a terminal, cmd goes on on the host if ssh is killed.
func Share ¶ added in v1.4.0
Share has ssh share one connection per host between the probes, logs and actions, rather than connect and log in for each. If the user's ssh config sets how it shares them or it cannot create sockets, connections are not shared.
Types ¶
This section is empty.