Help us shape the future of Go! Take the 2026 Go Developer Survey

runner

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: CC0-1.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceInfo

type DeviceInfo struct {
	Serial string
	State  string
}

DeviceInfo describes a connected Android device.

func DiscoverDevices

func DiscoverDevices(
	ctx context.Context,
) ([]DeviceInfo, error)

DiscoverDevices enumerates Android devices connected via ADB.

type DeviceRunner

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

DeviceRunner executes commands and transfers files on a single Android device via the gadb (pure-Go ADB) client library.

func NewDeviceRunner

func NewDeviceRunner(
	serial string,
) (*DeviceRunner, error)

NewDeviceRunner connects to the ADB server and selects the device identified by serial.

func (*DeviceRunner) Cleanup

func (r *DeviceRunner) Cleanup(
	ctx context.Context,
	remotePath string,
) (_err error)

Cleanup removes a file from the device.

func (*DeviceRunner) PushBinary

func (r *DeviceRunner) PushBinary(
	ctx context.Context,
	localPath string,
	remotePath string,
) (_err error)

PushBinary transfers a local file to remotePath on the device and marks it executable (0755).

func (*DeviceRunner) Run

func (r *DeviceRunner) Run(
	ctx context.Context,
	command string,
	timeout time.Duration,
) (_ *RunResult, _err error)

Run executes a shell command on the device. It captures combined stdout/stderr and parses the exit code by appending "; echo $?" to the command. If timeout is positive, the command is wrapped with the shell timeout utility.

type RunResult

type RunResult struct {
	Stdout   string
	Stderr   string
	ExitCode int
	Duration time.Duration
}

RunResult holds the output and metadata of a command execution on a device.

Jump to

Keyboard shortcuts

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