util

package
v0.0.0-...-bbc9ce3 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtomicallyWriteFile

func AtomicallyWriteFile(path string, mode os.FileMode, writeFileFunc func(*os.File) error) error

func ParsePackagesJSON

func ParsePackagesJSON(rd io.Reader) (map[string]string, error)

ParsePackagesJSON parses an update package's packages.json file for the express purpose of returning a map of package names and variant keys to the package's Merkle root as a value. This mimics the behavior of the function that parsed the legacy "packages" file format.

func RunCommand

func RunCommand(ctx context.Context, name string, arg ...string) ([]byte, []byte, error)

RunCommand executes a command on the host and returns the stdout and stderr as byte strings.

func RunWithDeadline

func RunWithDeadline(ctx context.Context, deadline time.Time, f func() error) error

RunWithDeadline runs a closure to runs the closure in a goroutine

func RunWithTimeout

func RunWithTimeout(ctx context.Context, timeout time.Duration, f func() error) error

RunWithTimeout runs a closure to completion, or returns an error if it times out.

func Untar

func Untar(ctx context.Context, dst string, src string) error

Untar untars a tar.gz file into a directory.

Types

type PackageJSON

type PackageJSON struct {
	Version json.Number `json:"version"`
	Content []string    `json:"content"`
}

Jump to

Keyboard shortcuts

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