xexec

package
Version: v0.0.0-...-5a98790 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package xexec helps creating exec.Cmd with logging and executing those commands without leaking orphan processes.

All functions return our standard xerror.Error in case of error.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(logger xlog.Logger, binary string, args ...string) (*exec.Cmd, error)

Command is a wrapper around exec.Command.

If given xlog.Logger has a xlog.DebugLevel, also logs the output from the command.

func CommandContext

func CommandContext(ctx context.Context, logger xlog.Logger, binary string, args ...string) (*exec.Cmd, error)

CommandContext is a wrapper around exec.CommandContext.

If given xlog.Logger has a xlog.DebugLevel, also logs the output from the command.

func LogBeforeExecute

func LogBeforeExecute(logger xlog.Logger, cmd *exec.Cmd)

LogBeforeExecute logs a command before its execution.

func Run

func Run(ctx context.Context, logger xlog.Logger, binary string, args ...string) error

Run runs a command.

If command finishes or fails to finish before context.Context deadline, kill the corresponding process in a way which does not leak orphan processes.

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

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