osexec

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package osexec implements subprocess execution functions

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidUID = errors.New("invalid UID")
	ErrInvalidGID = errors.New("invalid GID")
)

Custom errors.

Functions

func Execute

func Execute(cmd string, args []string, env []string) ([]byte, error)

Execute command and return stdout/stderr.

func ExecuteAs

func ExecuteAs(cmd string, args []string, uid int, gid int, env []string) ([]byte, error)

ExecuteAs executes a command as a given UID and GID and return stdout/stderr.

func ExecuteAsContext added in v0.2.0

func ExecuteAsContext(
	ctx context.Context,
	cmd string,
	args []string,
	uid int,
	gid int,
	env []string,
) ([]byte, error)

ExecuteAsContext executes a command as a given UID and GID with context and return stdout/stderr.

func ExecuteAsWithTimeout

func ExecuteAsWithTimeout(
	cmd string,
	args []string,
	uid int,
	gid int,
	timeout int,
	env []string,
) ([]byte, error)

ExecuteAsWithTimeout executes a command with timeout as a given UID and GID and return stdout/stderr.

func ExecuteContext added in v0.2.0

func ExecuteContext(ctx context.Context, cmd string, args []string, env []string) ([]byte, error)

ExecuteContext executes a command with context and return stdout/stderr.

func ExecuteWithTimeout

func ExecuteWithTimeout(cmd string, args []string, timeout int, env []string) ([]byte, error)

ExecuteWithTimeout exwecutes a command with timeout and return stdout/stderr.

Types

This section is empty.

Jump to

Keyboard shortcuts

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