remote

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: GPL-3.0 Imports: 15 Imported by: 0 modules, 0 packages

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 remote runs commands on hosts over ssh: to their end, as a stream of lines, or with the user's terminal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean

func Clean(s string) string

Clean makes remote text plain: it drops escape sequences, then any other control character but tabs and newlines.

func Command

func Command(ctx context.Context, h inventory.Host, tty bool, cmd string) *exec.Cmd

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

func Interactive(ctx context.Context, h inventory.Host, cmd string) *exec.Cmd

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

func Run(ctx context.Context, h inventory.Host, cmd string) (string, error)

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

func Share(ctx context.Context, hosts []inventory.Host) []inventory.Host

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.

func Stream

func Stream(ctx context.Context, h inventory.Host, cmd string, tty bool) <-chan string

Stream runs cmd on h, with a terminal if tty, and sends its output, stdout and stderr, line by line, without control characters; a failure, of cmd or of reading it, ends it with a line saying so. The channel closes when the command ends or ctx is cancelled.

Types

This section is empty.

Jump to

Keyboard shortcuts

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