import "github.com/egdaemon/eg/runtime/wasi/egunsafe/fficoreutils"

type Cmd

Cmd mirrors exec.Cmd for the egcoreutils reactor. the utility's stdio is the unix sockets the reactor listens on in proc/{id}/fd, and its working directory is the path in proc/{id}/cwd.

type Cmd struct {
    Path   string
    Args   []string  // includes the command name as Args[0], like exec.Cmd
    Env    []string  // nil uses the module's environment, like exec.Cmd
    Dir    string    // empty uses the module's working directory
    Stdin  io.Reader // nil is an empty stdin
    Stdout io.Writer // nil discards
    Stderr io.Writer // nil discards
    // contains filtered or unexported fields
}

func Command

func Command(ctx context.Context, name string, args ...string) *Cmd

Command returns the Cmd to execute the named utility with the given arguments.

func (*Cmd) Run

func (t *Cmd) Run() (err error)

Run executes the command and waits for it, a non zero exit is returned as an error.

⬤