process

package
v0.9.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NOTE: could be custom in config file for default.
	DEFAULT = 60 * time.Second
)

Common timeout.

View Source
var (
	ErrExecTimeout = errors.New("Process execution timeout")
)
View Source
var (
	Processes []*Process
)

List of existing processes.

Functions

func Add

func Add(desc string, cmd *exec.Cmd) int64

Add adds a existing process and returns its PID.

func Exec

func Exec(desc, cmdName string, args ...string) (string, string, error)

Exec starts executing a command, it records its process and has default timeout.

func ExecDir

func ExecDir(timeout time.Duration, dir, desc, cmdName string, args ...string) (string, string, error)

Exec starts executing a command in given path, it records its process and timeout.

func ExecTimeout

func ExecTimeout(timeout time.Duration, desc, cmdName string, args ...string) (string, string, error)

Exec starts executing a command, it records its process and timeout.

func Kill

func Kill(pid int64) error

Kill kills and removes a process from list.

func Remove

func Remove(pid int64)

Remove removes a process from list.

Types

type Process

type Process struct {
	Pid         int64 // Process ID, not system one.
	Description string
	Start       time.Time
	Cmd         *exec.Cmd
}

Process represents a working process inherit from Gogs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL