Documentation
¶
Index ¶
- func Exec(ctx *log.Context, cmd, workdir string, stdout, stderr io.WriteCloser, ...) (int, error)
- func ExecCmdInDir(ctx *log.Context, scriptFilePath, workdir string, ...) (error, int)
- func LogPaths(dir string) (stdout string, stderr string)
- func SetEnvironmentVariables(cfg *handlersettings.HandlerSettings) (string, error)
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 ¶
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.