bash

package
v0.0.0-...-f5fd88d Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Overview

Package bash provides bash command helpers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bash

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

Bash is api for bash process

func New

func New(options ...Option) (*Bash, error)

New creates a new bash runner and initializes it

func (*Bash) Close

func (b *Bash) Close()

Close closes current bash process and all the resources used by it

func (*Bash) Dir

func (b *Bash) Dir() string

Dir returns the directory where the runner instance is located

func (*Bash) Init

func (b *Bash) Init() error

Init initializes all resources for the bash runner.

Must be called before any call to Run or Close

You are advised to use bash.New instead, which calls this function automatically.

func (*Bash) Run

func (b *Bash) Run(cmd string) (stdout, stderr string, exitCode int, err error)

Run runs the command

type Option

type Option func(bash *Bash)

Option is an option for the Runner

func WithDir

func WithDir(dir string) Option

WithDir sets the directory where the bash runner will be located

func WithEnv

func WithEnv(env []string) Option

WithEnv sets env variables for the bash runner

Jump to

Keyboard shortcuts

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