utilities

package
v0.0.0-...-a462190 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: AGPL-3.0 Imports: 15 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PipeCommands

func PipeCommands(commands ...*exec.Cmd) ([]byte, error)

PipeCommands executes the commands received as input by feeding the output of one to the input of the other, exactly like Unix Pipe (|). Returns the output of the final command and the eventual error.

code inspired by https://gist.github.com/tyndyll/89fbb2c2273f83a074dc

func SafeJoin

func SafeJoin(parent, subdir string) (string, error)

SafeJoin performs a filepath.Join of 'parent' and 'subdir' but returns an error if the resulting path points outside of 'parent'.

func SaveFileonTempDir

func SaveFileonTempDir(filename string, data io.Reader) (string, error)

SaveFileonTempDir creates a temp directory and saves the file data as the filename in that directory. Returns an error if the agent doesn't have permission to create the folder. Returns an error if the filename doesn't form a valid path.

Note that path could be defined and still there could be an error.

func TellCommandNotToSpawnShell

func TellCommandNotToSpawnShell(_ *exec.Cmd)

TellCommandNotToSpawnShell will now spawn a shell

func VerifyInput

func VerifyInput(input string, signature string) error

VerifyInput will verify an input against a signature A valid signature is indicated by returning a nil error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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