exec

package
v3.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 6 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	*exec.Cmd
	Trace       bool      // Print composed command before execution.
	TraceWriter io.Writer // Where to write the trace output.
}

Cmd represents a command to be executed, with options to control its behavior. The Cmd struct embeds the standard library's exec.Cmd, adding additional fields to control the command's output and tracing.

func Command

func Command(name string, arg ...string) *Cmd

Command creates a new Cmd with the given name and arguments. The Cmd is configured with Trace set to true and TraceWriter set to os.Stdout. The Cmd's Env is set to the current environment.

func (*Cmd) Run

func (c *Cmd) Run() error

Run runs the command and waits for it to complete. If there is an error starting the command, it is returned. Otherwise, the command is waited for and its exit status is returned.

Jump to

Keyboard shortcuts

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