command

package
v0.0.0-...-c1f11ce Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear()

Clear clears the terminal.

func Elevate

func Elevate(password string)

Elevate elevates this functions runs the command "sudo -Sk -- echo", this forces sudo to re-authenticate and lets us enter the password to STDIN giving us the ability to run sudo commands

func ExecAndLogSudo

func ExecAndLogSudo(isRoot, noisy bool, exe string, args ...string) error

ExecAndLogSudo executes an elevated command and logs the output.

* if we're root, the command is executed directly * if we're not root, the command is prefixed with "sudo"

  • noisy determines if we should print the command to the user noisy isn't set to true by our copy caller, as it logs differently, but other callers set it.

func Run

func Run(binary string, args ...string) ([]string, error)

Run a command and return STDOUT

func RunErr

func RunErr(binary string, args ...string) ([]string, []string, error)

RunErr is just like command.Run() but also returns STDERR

func RunErrSudo

func RunErrSudo(isRoot bool, binary string, args ...string) ([]string, []string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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