Documentation
¶
Overview ¶
Package shell provides process execution and shell operations.
Package shell provides process execution and shell operations.
Package shell provides process execution and shell operations.
Index ¶
- Variables
- func Exec(ctx context.Context, excludeStdout bool, dir, name string, args ...string) error
- func ExecWithContext(ctx context.Context, excludeStdout bool, dir, name string, args ...string) error
- func ExecWithSudo(ctx context.Context, excludeStdout bool, dir, name string, args ...string) error
- func ExecWithSudoContext(ctx context.Context, excludeStdout bool, dir, name string, args ...string) error
- func RunScript(cmds string) error
- func RunScriptInFakeroot(ctx context.Context, cmds, packageName string, extraEnv ...[]string) error
- func RunScriptWithPackage(ctx context.Context, cmds, packageName string, extraEnv ...[]string) error
- type GitProgressWriter
- type PackageDecoratedWriter
Constants ¶
This section is empty.
Variables ¶
var ( // SetVerbose configures verbose logging output. SetVerbose = logger.SetVerbose // MultiPrinter handles concurrent output formatting. MultiPrinter = logger.MultiPrinter )
Functions ¶
func ExecWithContext ¶
func ExecWithContext( ctx context.Context, excludeStdout bool, dir, name string, args ...string, ) error
ExecWithContext executes a command with context for cancellation control.
func ExecWithSudo ¶
ExecWithSudo executes a command with sudo if the user is not running as root. This is specifically for package manager commands that need elevated privileges.
func ExecWithSudoContext ¶
func ExecWithSudoContext( ctx context.Context, excludeStdout bool, dir, name string, args ...string, ) error
ExecWithSudoContext executes a command with sudo if needed, with context for cancellation.
func RunScriptInFakeroot ¶
RunScriptInFakeroot executes a shell script identically to RunScriptWithPackage but wraps every subprocess in a Linux user-namespace fakeroot so that ownership operations (install -o root, chown, etc.) succeed without real root privileges. Use this for the package() stage of PKGBUILD execution.
func RunScriptWithPackage ¶
func RunScriptWithPackage(ctx context.Context, cmds, packageName string, extraEnv ...[]string) error
RunScriptWithPackage executes a shell script with package-specific output formatting. An optional extraEnv slice of "KEY=VALUE" pairs may be supplied; each entry overrides or extends the inherited process environment for this script invocation only, without mutating os.Environ(). This makes the function safe to call concurrently from parallel build goroutines.
Types ¶
type GitProgressWriter ¶
type GitProgressWriter struct {
// contains filtered or unexported fields
}
GitProgressWriter handles git command output with progress formatting.
func NewGitProgressWriter ¶
func NewGitProgressWriter(writer io.Writer, packageName string) *GitProgressWriter
NewGitProgressWriter creates a new GitProgressWriter instance.
func (*GitProgressWriter) Close ¶
func (gpw *GitProgressWriter) Close() error
Close returns the buffer to the pool and should be called when done with the writer.
type PackageDecoratedWriter ¶
type PackageDecoratedWriter struct {
// contains filtered or unexported fields
}
PackageDecoratedWriter decorates output with package name prefixes.
func NewPackageDecoratedWriter ¶
func NewPackageDecoratedWriter(writer io.Writer, packageName string) *PackageDecoratedWriter
NewPackageDecoratedWriter creates a new PackageDecoratedWriter instance.
func (*PackageDecoratedWriter) Close ¶
func (pdw *PackageDecoratedWriter) Close() error
Close returns the buffer to the pool and should be called when done with the writer.