sh

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExecCommand = executeCommand

Alias for os/exec.Command to allow mocking the command executions in tests. see https://npf.io/2015/06/testing-exec-command/ for more information about.

Functions

func ExecSudoCommand

func ExecSudoCommand(command string, args ...string) *exec.Cmd

ExecSudoCommand executes the given command in the same way as os.ExecCommand would do it. But with the difference that ExecSudoCommand prefixes the command with sudo.

func InitSudo

func InitSudo() error

Executes echo with sudo and connected stdin, stdout and stderr to ask for the users password. This allows to use sudo for commands which internal process stdout and stderr which are not connected to the current tty.

func IsExitCode

func IsExitCode(err error, exitCode int) bool

IsExitCode checks the given error for a process exit error and if the exit code is the expected one.

func RunCmd

func RunCmd(command string, args ...string) (string, error)

RunCmd executes the given command including the current environment and returns the combined output as string.

func RunSudoCmd

func RunSudoCmd(command string, args ...string) (string, error)

RunSudoCmd executes the given command including the current environment using sudo and returns the combined output as string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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