utils

package
v5.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecCmd

func ExecCmd(name string, args ...string) (string, error)

ExecCmd executes a command with args and returns its output as a string along with an error, if any.

func ExecCmdWithStdStreams

func ExecCmdWithStdStreams(stdin io.Reader, stdout, stderr io.Writer, env []string, name string, args ...string) error

ExecCmdWithStdStreams execute a command with the specified standard streams.

func GetRandomPort

func GetRandomPort() (int, error)

Find a random, open port on the host.

func GuardedRemoveAll

func GuardedRemoveAll(path string) error

GuardedRemoveAll functions much like os.RemoveAll but will not delete certain catastrophic paths.

func ProgressBar

func ProgressBar(prefix string, size int64, onComplete string) (*mpb.Progress, *mpb.Bar)

func RemoveFilesExcept added in v5.5.0

func RemoveFilesExcept(path string, excludeFile string) error

RemoveFilesExcept removes all files in a directory except for the one specified by excludeFile and will not delete certain catastrophic paths.

func Tar

func Tar(source string) (io.ReadCloser, error)

Tar creates a tarball from source and returns a readcloser of it

func TarToFilesystem

func TarToFilesystem(source string, tarball *os.File) error

TarToFilesystem creates a tarball from source and writes to an os.file provided

func TarWithChroot

func TarWithChroot(source string) (io.ReadCloser, error)

TarWithChroot creates a tarball from source and returns a readcloser of it while chrooted to the source.

Types

This section is empty.

Jump to

Keyboard shortcuts

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