exechelper

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package exechelper streamlines the running of external commands while both capturing and logging their output.

It builds on os/exec, expecting an instance of Cmd to manipulate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(cmd *exec.Cmd, logger log.FieldLogger, outputLogger OutputLogger) ([]byte, []byte, error)

Run invokes cmd.Run, both logging and returning STDOUT and STDERR, optionally transforming the output first.

func RunWithEnv added in v0.37.0

func RunWithEnv(cmd *exec.Cmd, logger log.FieldLogger, outputLogger OutputLogger) ([]byte, []byte, error)

RunWithEnv applies environment variables in the command arguments list and then invokes cmd.Run, both logging and returning STDOUT and STDERR, optionally transforming the output first.

Types

type OutputLogger

type OutputLogger func(line string, logger log.FieldLogger)

OutputLogger allows custom logging of the run command output.

Jump to

Keyboard shortcuts

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