import "github.com/egdaemon/eg/runtime/wasi/shell"
func Run(ctx context.Context, cmds ...Command) (err error)
type Command struct {
// contains filtered or unexported fields
}
func New(cmd string) Command
New create a new command with reasonable defaults. defaults:
timeout: 5 minutes.
func Newf(cmd string, options ...any) Command
Newf provides a simple printf form of creating commands.
func Runtime() Command
Runtime creates a Command with no specified command to run. and can be used as a template:
tmp := shell.Runtime().Environ("FOO", "BAR")
shell.Run(
tmp.New("ls -lha"),
tmp.New("echo hello world"),
)
func (t Command) Attempts(a int16) Command
number of attempts to make before giving up.
func (t Command) Directory(d string) Command
directory to run the command in. must be a relative path.
func (t Command) Environ(k, v string) Command
append a specific key/value environment variable.
func (t Command) EnvironFrom(environ ...string) Command
append a set of environment variables in the form KEY=VALUE to the environment.
func (t Command) Lenient(d bool) Command
directory to run the command in. must be a relative path.
func (t Command) New(cmd string) Command
New clone the current command configuration and replace the command that will be executed.
func (t Command) Newf(cmd string, options ...any) Command
Newf provides a simple printf form of creating commands.
func (t Command) Timeout(d time.Duration) Command
maximum duration for a command to run.