exec

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2020 License: MIT Imports: 14 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDir

func EnsureDir(dir string) (err error)

EnsureDir checks and creates the directory.

func EnsureDirEnh

func EnsureDirEnh(dir string) (err error)

EnsureDirEnh checks and creates the directory, via sudo if necessary.

func FileExists

func FileExists(name string) bool

FileExists returns the existence of an directory or file

func ForDir added in v0.1.18

func ForDir(root string, cb func(depth int, cwd string, fi os.FileInfo) (stop bool, err error)) (err error)

ForDir walks on `root` directory and its children

func ForDirMax added in v0.1.18

func ForDirMax(root string, initialDepth, maxDepth int, cb func(depth int, cwd string, fi os.FileInfo) (stop bool, err error)) (err error)

ForDirMax walks on `root` directory and its children with nested levels up to `maxLength`.

Example - discover folder just one level

     _ = ForDirMax(dir, 0, 1, func(depth int, cwd string, fi os.FileInfo) (stop bool, err error) {
			if fi.IsDir() {
				return
			}
         // ... doing something for a file,
			return
		})

func GetCurrentDir

func GetCurrentDir() string

GetCurrentDir returns the current workingFlag directory it should be equal with os.Getenv("PWD")

func GetExecutableDir

func GetExecutableDir() string

GetExecutableDir returns the executable file directory

func GetExecutablePath added in v0.1.16

func GetExecutablePath() string

GetExecutablePath returns the executable file path

func IsDirectory

func IsDirectory(path string) (bool, error)

IsDirectory tests whether `path` is a directory or not

func IsEAccess

func IsEAccess(err error) bool

IsEAccess detects whether err is a EACCESS errno or not

func IsExecAll added in v0.1.18

func IsExecAll(mode os.FileMode) bool

IsExecOwner give the result of whether a file can be invoked by all users

func IsExecAny added in v0.1.18

func IsExecAny(mode os.FileMode) bool

IsExecOwner give the result of whether a file can be invoked by anyone

func IsExecGroup added in v0.1.18

func IsExecGroup(mode os.FileMode) bool

IsExecOwner give the result of whether a file can be invoked by its unix-group

func IsExecOther added in v0.1.18

func IsExecOther(mode os.FileMode) bool

IsExecOwner give the result of whether a file can be invoked by its unix-all

func IsExecOwner added in v0.1.18

func IsExecOwner(mode os.FileMode) bool

IsExecOwner give the result of whether a file can be invoked by its unix-owner

func IsExitError

func IsExitError(err error) (int, bool)

IsExitError checks the error object

func IsRegularFile

func IsRegularFile(path string) (bool, error)

IsRegularFile tests whether `path` is a normal regular file or not

func NormalizeDir

func NormalizeDir(s string) string

NormalizeDir make dir name normalized

func RemoveDirRecursive

func RemoveDirRecursive(dir string) (err error)

RemoveDirRecursive removes a directory and any children it contains.

func Run

func Run(command string, arguments ...string) error

Run runs an OS command

func RunCommand

func RunCommand(command string, readStdout bool, arguments ...string) (retCode int, stdoutText string, err error)

RunCommand runs an OS command

func RunWithOutput

func RunWithOutput(command string, arguments ...string) (int, string, error)

RunWithOutput runs an OS command and collect the result outputting

func Sudo

func Sudo(command string, arguments ...string) (int, string, error)

Sudo runs an OS command with sudo prefix

Types

This section is empty.

Jump to

Keyboard shortcuts

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