{"modulePath":"github.com/generaltso/gitea","version":"v1.2.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package process\n\n## Variables\n\n```go\nvar (\n\t// ErrExecTimeout represent a timeout error\n\tErrExecTimeout = errors.New(\"Process execution timeout\")\n)\n```\n\n## Types\n\n```go\ntype Manager struct {\n\tProcesses map[int64]*Process\n\t// contains filtered or unexported fields\n}\n```\nManager knows about all processes and counts PIDs.\n\n```go\nfunc GetManager() *Manager\n```\nGetManager returns a Manager and initializes one as singleton if there's none yet\n\n```go\nfunc (pm *Manager) Add(description string, cmd *exec.Cmd) int64\n```\nAdd a process to the ProcessManager and returns its PID.\n\n```go\nfunc (pm *Manager) Exec(desc, cmdName string, args ...string) (string, string, error)\n```\nExec a command and use the default timeout.\n\n```go\nfunc (pm *Manager) ExecDir(timeout time.Duration, dir, desc, cmdName string, args ...string) (string, string, error)\n```\nExecDir a command and use the default timeout.\n\n```go\nfunc (pm *Manager) ExecDirEnv(timeout time.Duration, dir, desc string, env []string, cmdName string, args ...string) (string, string, error)\n```\nExecDirEnv runs a command in given path and environment variables, and waits for its completion up to the given timeout (or DefaultTimeout if -1 is given). Returns its complete stdout and stderr outputs and an error, if any (including timeout)\n\n```go\nfunc (pm *Manager) ExecTimeout(timeout time.Duration, desc, cmdName string, args ...string) (string, string, error)\n```\nExecTimeout a command and use a specific timeout duration.\n\n```go\nfunc (pm *Manager) Kill(pid int64) error\n```\nKill and remove a process from list.\n\n```go\nfunc (pm *Manager) Remove(pid int64)\n```\nRemove a process from the ProcessManager.\n\n```go\ntype Process struct {\n\tPID         int64 // Process ID, not system one.\n\tDescription string\n\tStart       time.Time\n\tCmd         *exec.Cmd\n}\n```\nProcess represents a working process inherit from Gogs.\n\n","path":"github.com/generaltso/gitea/modules/process","name":"process","synopsis":"","isRedistributable":true}
