subprocess

package
v0.0.0-...-223af15 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package subprocess provides functionality to execute system commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(pid int) (bool, error)

Exists returns true if a pid is assigned to a process that is actively running. Based on comment from: https://github.com/golang/go/issues/34396

Types

type SystemExecutor

type SystemExecutor struct{}

SystemExecutor uses the native os/exec package to execute subprocesses.

func (SystemExecutor) Execute

Execute runs the given command and returns stdout and stderr. Returns *exec.ExitError if the command ran with a non-zero exit code.

func (SystemExecutor) ExecuteInBackground

func (SystemExecutor) ExecuteInBackground(ctx context.Context, cmd *command.Command, oe outerr.OutErr, ch chan *command.Result) error

ExecuteInBackground executes the command in the background. Command result is written to the passed channel.

func (SystemExecutor) ExecuteWithOutErr

func (SystemExecutor) ExecuteWithOutErr(ctx context.Context, cmd *command.Command, oe outerr.OutErr) error

ExecuteWithOutErr runs the given command and returns stdout and stderr in an OutErr object. Returns *exec.ExitError if the command ran with a non-zero exit code.

Jump to

Keyboard shortcuts

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