Documentation ¶
Index ¶
- Constants
- Variables
- func CacheAdmin(ctx context.Context, prompt string) error
- func CaptureErr(ctx context.Context, cmd *dexec.Cmd) ([]byte, error)
- func CreateNewProcessGroup(cmd *dexec.Cmd)
- func IsAdmin() bool
- func KillProcessGroup(ctx context.Context, cmd *exec.Cmd, signal os.Signal)
- func Run(ctx context.Context, env map[string]string, exe string, args ...string) error
- func RunningInContainer() bool
- func Start(ctx context.Context, env map[string]string, exe string, args ...string) (*dexec.Cmd, error)
- func StartInBackground(includeEnv bool, args ...string) error
- func StartInBackgroundAsRoot(ctx context.Context, args ...string) error
- func StdCommand(ctx context.Context, exe string, args ...string) *dexec.Cmd
- func Terminate(p *os.Process) error
- func Wait(ctx context.Context, cancel context.CancelFunc, cmd *dexec.Cmd) error
Constants ¶
const SIGTERM = unix.SIGTERM
Variables ¶
var CommandContext = dexec.CommandContext //nolint:gochecknoglobals // OS-specific function replacement
Functions ¶
func CacheAdmin ¶ added in v2.14.3
CacheAdmin will ensure that the current process is able to invoke subprocesses with admin rights without having to ask for the password again. This is needed among other things to make sure the integration tests can see that a password is being asked for.
func CaptureErr ¶ added in v2.13.0
CaptureErr disables command logging, captures Stdout and Stderr to two different buffers. If an error occurs, the stdout output is discarded and the stderr output is included in the returned error unless the error itself already contains that output. On success, any output on stderr is discarded and the stdout output is returned.
func CreateNewProcessGroup ¶ added in v2.14.0
CreateNewProcessGroup ensures that the process uses a process group of its own to prevent it getting affected by <ctrl-c> in the terminal.
func KillProcessGroup ¶ added in v2.14.0
func Run ¶
Run will run the given executable with given args and env, wait for it to terminate, and return the result. The run will dispatch signals as appropriate for the given platform (SIGTERM and SIGINT on Unix platforms and os.Interrupt on Windows).
func RunningInContainer ¶ added in v2.12.0
func RunningInContainer() bool
RunningInContainer returns true if the current process runs from inside a docker container.
func Start ¶ added in v2.6.0
func Start(ctx context.Context, env map[string]string, exe string, args ...string) (*dexec.Cmd, error)
Start will start the given executable with given args and env, and return the command. The signals are dispatched as appropriate for the given platform (SIGTERM and SIGINT on Unix platforms and os.Interrupt on Windows).
func StartInBackground ¶
func StartInBackgroundAsRoot ¶
func StdCommand ¶ added in v2.12.0
StdCommand returns a command that redirects stdout and stderr to dos.Stdout and dos.Stderr and performs no logging.
Types ¶
This section is empty.