shell

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package shell wraps shell execution

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompletedProcess

type CompletedProcess struct {
	Name       string
	Args       []string
	ReturnCode int
	Stdout     string
	Stderr     string
}

CompletedProcess represents a subshell execution that finished, and includes its arguments, return code, and standard buffers as strings.

type Shell

type Shell interface {
	NewCommand(program string, args ...string) *exec.Cmd
	Exec(cmd *exec.Cmd) (*CompletedProcess, error)
	Exists(program string) bool
	CurrentDirectory() string
}

Shell is an abstraction for shell-program execution meant to make testing and client design easier.

func New

func New(ctx *context.Context) Shell

New returns a new shell bound to the provided context.

Directories

Path Synopsis
Package shelltest provides utilities for mocking the login shell.
Package shelltest provides utilities for mocking the login shell.

Jump to

Keyboard shortcuts

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