bash

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Run = func(command string) int {
	cmd := exec.Command("bash", "-c", command)
	var waitStatus syscall.WaitStatus

	if err := cmd.Run(); err != nil {
		if exitError, ok := err.(*exec.ExitError); ok {
			waitStatus = exitError.Sys().(syscall.WaitStatus)
			return waitStatus.ExitStatus()
		}
	}

	return 0
}

Run takes a command and returns the system status code that results from running said command via bash.

Functions

This section is empty.

Types

type ExecService

type ExecService struct{}

ExecService is a service that knows how to execute external commands via bash.

func NewExecService

func NewExecService() *ExecService

NewExecService creates and returns a new ExecService instance.

func (*ExecService) Run

func (service *ExecService) Run(command string) int

Run takes a command and returns the result of running it with bash.Run.

Jump to

Keyboard shortcuts

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