exec

package
v1.3.15 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(ctx *log.Context, cmd, workdir string, stdout, stderr io.WriteCloser, cfg *handlersettings.HandlerSettings) (int, error)

Exec runs the given cmd in /bin/sh, saves its stdout/stderr streams to the specified files. It waits until the execution terminates.

On error, an exit code may be returned if it is an exit code error. Given stdout and stderr will be closed upon returning.

func ExecCmdInDir

func ExecCmdInDir(ctx *log.Context, scriptFilePath, workdir string, cfg *handlersettings.HandlerSettings) (error, int)

ExecCmdInDir executes the given command in given directory and saves output to ./stdout and ./stderr files (truncates files if exists, creates them if not with 0600/-rw------- permissions).

Ideally, we execute commands only once per sequence number in run-command-handler, and save their output under /var/lib/waagent/<dir>/download/<seqnum>/*.

func LogPaths

func LogPaths(dir string) (stdout string, stderr string)

LogPaths returns stdout and stderr file paths for the specified output directory. It does not create the files.

func SetEnvironmentVariables

func SetEnvironmentVariables(cfg *handlersettings.HandlerSettings) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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