proc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

proc extends the standard exec package to deal with processes in a more graceful way.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GracefulCommandContext

func GracefulCommandContext(ctx context.Context, name string, args ...string) *exec.Cmd

GracefulCommandContext has the same purpose as exec.CommandContext, but the cancellation is done gracefully, and the process descendants are killed as well.

func Kill

func Kill(pid int, force bool) error

Kill kills a process by pid.

Be careful: exec.Process.Kill() (which eventually is what is called by exec.CommandContext) does not gracefully kill the process, and does not kill the child processes. Killing child processes can be done programmatically, but it's an involved task (see, e.g., https://groups.google.com/forum/#!topic/golang-nuts/nayHpf8dVxI).

Therefore, we call the native executables to do the heavy lifting for us.

func KillPort

func KillPort(port int) error

KillPort kills the process that is listening on a given port.

Types

This section is empty.

Jump to

Keyboard shortcuts

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