command

package
v0.4.27 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ScriptTimeout = 60 * time.Second

ScriptTimeout bounds each script ExecuteScripts runs: a hung script would otherwise hold the start of the service until systemd kills it, and then again at every restart. A variable so tests can shorten it.

Functions

func ExecResultStr

func ExecResultStr(cmdStr string) (string, error)

func ExecResultStrArray

func ExecResultStrArray(cmdStr string) ([]string, error)

func ExecStdin

func ExecStdin(stdinStr string, name string, args ...string) (string, error)

func ExecuteScripts

func ExecuteScripts(scriptDirectory string) error

ExecuteScripts runs every regular file of scriptDirectory, in name order, each with the interpreter of its shebang line (/bin/sh without one) and for at most ScriptTimeout. Every run is logged with its output. A failing script does not stop the next ones; the failures come back joined. A missing directory is not an error.

A script that starts a daemon must redirect the daemon's output: once the script has exited, its pipes are closed after a short delay, and a daemon still writing to them is killed by SIGPIPE.

func OnlyExec deprecated

func OnlyExec(cmdStr string) (string, error)

Deprecated: This method is not safe, sould have ensure input.

Types

This section is empty.

Jump to

Keyboard shortcuts

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