wrapcommander

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2019 License: MIT Imports: 3 Imported by: 21

README

wrapcommander

Build Status MIT License GoDoc

Description

Utility for creating wrapper command.

Author

Songmu

Documentation

Index

Constants

View Source
const (
	ExitNormal            = 0
	ExitUnknownErr        = 125
	ExitCommandNotInvoked = 126
	ExitCommandNotFound   = 127
)

exit statuses are same with GNU coreutils

Variables

This section is empty.

Functions

func ErrorToWaitStatus

func ErrorToWaitStatus(err error) (syscall.WaitStatus, bool)

ErrorToWaitStatus try to convert error into syscall.WaitStatus

func IsExecFormatError

func IsExecFormatError(err error) bool

IsExecFormatError returns a boolean indicating whether the error is known to report that format of an executable file is invalid. ex. "fork/exec ./prog: exec format error"

func IsInvoked

func IsInvoked(err error) bool

IsInvoked returns a boolean indicating whether the error is known to report that the command is invoked or not.

func IsNotExist

func IsNotExist(err error) bool

IsNotExist is alias of os.IsNotExist for now

func IsNotFoundInPATH

func IsNotFoundInPATH(err error) bool

IsNotFoundInPATH returns a boolean indicating whether the error is known to report that a prog is not found in $PATH. ex. "exec: \"prog\": executable file not found in $PATH"

func IsPermission

func IsPermission(err error) bool

IsPermission is alias of os.IsPermission for now

func ResolveExitCode

func ResolveExitCode(err error) int

ResolveExitCode retruns a int as command exit code from an error.

func SeparateArgs

func SeparateArgs(args []string) ([]string, []string)

SeparateArgs separates command line arguments for wrapper command.

func WaitStatusToExitCode

func WaitStatusToExitCode(st syscall.WaitStatus) int

WaitStatusToExitCode converts WaitStatus to ExitCode

Types

type ExitStatus

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

ExitStatus represents command exit status information

func ResolveExitStatus

func ResolveExitStatus(err error) *ExitStatus

ResolveExitStatus resolve ExitStatus from command error

func (*ExitStatus) Err

func (es *ExitStatus) Err() error

Err returns original error

func (*ExitStatus) ExitCode

func (es *ExitStatus) ExitCode() int

ExitCode of the command

func (*ExitStatus) Invoked

func (es *ExitStatus) Invoked() bool

Invoked or not

func (*ExitStatus) Signal

func (es *ExitStatus) Signal() syscall.Signal

Signal returns a received signal

func (*ExitStatus) Signaled

func (es *ExitStatus) Signaled() bool

Signaled or not

Jump to

Keyboard shortcuts

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