Documentation ¶
Overview ¶
Package interp implements an interpreter that executes shell programs. It aims to support POSIX, but its support is not complete yet. It also supports some Bash features.
This package is a work in progress and EXPERIMENTAL; its API is not subject to the 1.x backwards compatibility guarantee.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Runner ¶
type Runner struct { // Env specifies the environment of the interpreter. // If Env is nil, Run uses the current process's environment. Env []string // Dir specifies the working directory of the command. If Dir is // the empty string, Run runs the command in the calling // process's current directory. Dir string // Params are the current parameters, e.g. from running a shell // file or calling a function. Accessible via the $@/$* family // of vars. Params []string Stdin io.Reader Stdout io.Writer Stderr io.Writer // Context can be used to cancel the interpreter before it finishes Context context.Context // contains filtered or unexported fields }
A Runner interprets shell programs. It cannot be reused once a program has been interpreted.
Note that writes to Stdout and Stderr may not be sequential. If you plan on using an io.Writer implementation that isn't safe for concurrent use, consider a workaround like hiding writes behind a mutex.
Click to show internal directories.
Click to hide internal directories.