Documentation
¶
Overview ¶
Package agentproc starts and stops ACP agent processes.
Index ¶
- Constants
- func AppendPath(env []string, dirs ...string) []string
- func BuildEnv(base []string, add map[string]string, remove []string) []string
- func CachedLoginShellEnv() []string
- func Getenv(env []string, key string) string
- func KillGroupByPID(pid int)
- func LoginShellEnv(ctx context.Context) []string
- func LookPath(command string, env []string) (string, error)
- type Process
- type Spec
Constants ¶
const StderrTail = 8 << 10
StderrTail is how much of an agent's stderr is kept for error messages.
Variables ¶
This section is empty.
Functions ¶
func AppendPath ¶ added in v0.1.1
AppendPath adds folders to the end of PATH in env, skipping ones already there.
func CachedLoginShellEnv ¶
func CachedLoginShellEnv() []string
CachedLoginShellEnv is LoginShellEnv, read once per process.
func KillGroupByPID ¶
func KillGroupByPID(pid int)
KillGroupByPID stops a leftover process group from an earlier run. Agents lead their own group, so a reused pid that leads no group is left alone.
func LoginShellEnv ¶
LoginShellEnv returns the environment of the user's login shell, which has the PATH agents usually need. Apps started from a desktop or a service manager get a minimal PATH otherwise. Falls back to os.Environ().
Types ¶
type Process ¶
type Process struct {
Stdin io.WriteCloser
Stdout io.ReadCloser
// contains filtered or unexported fields
}
Process is a running agent.
func (*Process) Done ¶
func (p *Process) Done() <-chan struct{}
Done is closed when the process has exited.
func (*Process) ExitCode ¶
ExitCode is the exit code, or -1 while running or when killed by a signal.