Documentation ¶
Overview ¶
TODO: Split up this package
Index ¶
- Constants
- func ChildPids(pid int) ([]int, error)
- func ExponentialBackoff(start, max time.Duration, factor float64) func() <-chan time.Time
- func KillProcessTree(pid int) error
- func Main(args []string)
- func Tree(pid int) (map[int]ps.Process, error)
- func TreePids(pid int) ([]int, error)
- type Cmd
- type Config
- type TreeSnapshot
Constants ¶
View Source
const ( // DefaultNotifySignal is the default signal sent to a command on changes // (in order to get it to restart). DefaultNotifySignal = syscall.SIGTERM )
Variables ¶
This section is empty.
Functions ¶
func ExponentialBackoff ¶
func KillProcessTree ¶
KillProcessTree kills the given pid as well as any descendant processes.
It tries to kill as many processes in the tree as possible. If it encounters an error along the way, it proceeds to kill subsequent pids in the tree. It returns the last error encountered, if any.
Types ¶
type Config ¶
type Config struct { // Command is the command and arguments to be executed upon any change. // // The command is not interpreted using a shell. If you would like shell // features such as environment variable expansion, specify the command // using something like the following: // // ["sh", "-c", "$YOUR_COMMAND"] Command []string `json:"command"` // Watch specifies a list of files or directories to be watched. Defaults to // the current working directory from which the command is invoked. // Directories are watched recursively. // TODO(bduffany): Accept glob patterns here. Watch []string `json:"watch,omitempty"` // Only specifies a list of allowed patterns. If non-empty, at least one // pattern must match in order for the command to be executed. Only []string `json:"only,omitempty"` // Ignore specifies a list of paths to be ignored. Glob patterns are supported. Ignore []string `json:"ignore,omitempty"` // UseDefaultIgnoreList specifies whether to use the default list of // ignore patterns. These will be appended to the list of ignore patterns. // Defaults to true. UseDefaultIgnoreList *bool `json:"useDefaultIgnoreList,omitempty"` // UseGitignore specifies whether to respect .gitignore files when watching // directories. // Defaults to true. UseGitignore *bool `json:"useGitignore,omitempty"` // NotifySignal is the signal used to notify the command of file changes. // Defaults to "SIGINT" (Ctrl+C), which should gracefully stop most // well-behaved commands. NotifySignal *string `json:"notifySignal,omitempty"` // Lockfile specifies a path to a file which, if it exists, will cause // file-based restarts to be paused until the file is removed. This can be // used to temporarily pause godemon's file-watching behavior while running a // batch of updates, then finally trigger a restart only once all the updates // are complete. Lockfile *string `json:"lockfile,omitempty"` // Clear specifies whether to clear the terminal on each re-run. // // Note, this option is just for convenience. The same functionality can // be achieved with the following command: // godemon [ flags ... ] sh -c 'clear && exec {command}' Clear bool `json:"clear,omitempty"` // contains filtered or unexported fields }
type TreeSnapshot ¶
type TreeSnapshot struct {
Processes map[int]ps.Process
}
TreeSnapshot represents a snapshot of the process tree rooted at the current process tree.
func NewTreeSnapshot ¶
func NewTreeSnapshot() (*TreeSnapshot, error)
func (*TreeSnapshot) Diff ¶
func (s *TreeSnapshot) Diff() (*TreeSnapshot, error)
Diff returns a snapshot containing only processes which are different from the previous snapshot.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.