utils

package
v0.0.0-...-9364404 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyAtomicKeepMode

func CopyAtomicKeepMode(src, dst string, defaultMode os.FileMode) error

CopyAtomicKeepMode is like CopyAtomicMode by tries to keep the mode bits of dst if it exists. If dst does not yet exist the mode bits are set to defaultMode.

func CopyAtomicMode

func CopyAtomicMode(src, dst string, mode os.FileMode) error

CopyAtomicMode is like CreateAtomic but copies data from src.

func CreateAtomic

func CreateAtomic(dest string, fileMode os.FileMode, r io.Reader) error

CreateAtomic creates or overwrites a file at dest atomically using data from r. Atomic means that even in case of a power outage, dest will never be a zero-length file. It will always either contain the previous data (or not exist) or the new data but never anything in between.

func ExecCommand

func ExecCommand(ctx context.Context, workDir string, cmd string, opts *ExecOptions) error

ExecCommand executes cmd and returns any error encountered.

func FileMode

func FileMode(path string) (os.FileMode, error)

FileMode returns the file mode of path.

Types

type ExecOptions

type ExecOptions struct {
	Attrs      *syscall.SysProcAttr
	PipeOutput bool
	PipeInput  bool
	Env        map[string]string
	ExitCode   *int64
}

type ExitCodeError

type ExitCodeError struct {
	Code   int
	Output string
}

func (*ExitCodeError) Error

func (ece *ExitCodeError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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