cmd

package
v0.0.0-...-05f81da Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CracklibCheck

func CracklibCheck(texttoinpsect string, stringtype string) (bool, string)

CracklibCheck runs the cracklib-check executable piping password to stdin of cmd and writing stdoutput to byte buffer stringtype is used to inform kind of information we are checking: password or passphrase

func PipeRunAndLog

func PipeRunAndLog(in string, args ...string) error

PipeRunAndLog is similar to RunAndLog runs a command and writes the output to default logger and also writes in to the process stdin

func PipeRunAndPipeOut

func PipeRunAndPipeOut(in string, out *bytes.Buffer, args ...string) error

PipeRunAndPipeOut is similar to PipeRunAndLog but runs a command by feeding a string to stdin of Cmd and output is written to a byte buffer instead of a log

func Run

func Run(writer io.Writer, args ...string) error

Run executes a command and uses writer to write both stdout and stderr args are the actual command and its arguments

func RunAndLog

func RunAndLog(args ...string) error

RunAndLog executes a command (similar to Run) but takes care of writing the output to default logger

func RunAndLogWithEnv

func RunAndLogWithEnv(env map[string]string, args ...string) error

RunAndLogWithEnv does the same as RunAndLog but it changes the execution's environment variables adding the provided ones by the env argument

func RunAndProcessOutput

func RunAndProcessOutput(printPrefix string, output Output, args ...string) error

RunAndProcessOutput executes a command and process the output from Stdout and Stderr according to the implementor args are the actual command and its arguments

Types

type Output

type Output interface {
	Process(printPrefix, line string)
}

Output interface allows implementors to process the output from a command according to their specific case

Jump to

Keyboard shortcuts

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