Documentation
¶
Index ¶
- func FlatChildTree(pid int, withRoot bool) ([]*process.Process, error)
- func GetTerm(pid int) (string, error)
- func Kill(pid int) error
- func KillWithContext(ctx context.Context, pid int) error
- func SendMessage(pid int, msg string) error
- func SendMessageWithContext(ctx context.Context, pid int, msg string) error
- func SendSigintOrCloseWindow(pid int) error
- func SendSigintOrCloseWindowWithContext(ctx context.Context, pid int) error
- func SendSigintOrCtrlBreak(pid int) error
- func SendSigintOrCtrlBreakWithContext(ctx context.Context, pid int) error
- func SendSigintOrCtrlC(pid int) error
- func SendSigintOrCtrlCWithContext(ctx context.Context, pid int) error
- func SendSignal(pid int, sig syscall.Signal) error
- func SendSignalWithContext(ctx context.Context, pid int, sig syscall.Signal) error
- func WaitForProcStop(ctx context.Context, pid int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FlatChildTree ¶
FlatChildTree returns gopsutil Process instances of all descendants of a process with the specified PID `pid`.
The first element is deepest descendant. The last one is a progenitor or closest child.
If the `withRoot` argument is set to true, add root process to the end.
func KillWithContext ¶
KillWithContext kills process with PID `pid` using context `ctx`.
func SendMessage ¶
SendMessage is the same as SendMessageWithContext with background context.
func SendMessageWithContext ¶
SendMessageWithContext writes a `msg` message to the console process with PID `pid` using context `ctx`.
`msg` must end with "\n" on Linux and with "\r" on macOS to be sent.
Requires root privilegies (e.g. run as sudo).
func SendSigintOrCloseWindow ¶ added in v1.2.0
SendSigintOrCloseWindow is the same as SendSigintOrCloseWindowWithContext with background context.
func SendSigintOrCloseWindowWithContext ¶ added in v1.2.0
SendSigintOrCloseWindowWithContext sends SIGINT on POSIX and closes main GUI window on Windows of process with PID `pid` using context `ctx`.
func SendSigintOrCtrlBreak ¶ added in v1.2.0
SendSigintOrCtrlBreak is the same as SendSigintOrCtrlBreakWithContext with background context.
func SendSigintOrCtrlBreakWithContext ¶ added in v1.2.0
SendSigintOrCtrlBreakWithContext sends SIGINT on POSIX and CTRL_BREAK_EVENT on Windows to process with PID `pid` using context `ctx`.
func SendSigintOrCtrlC ¶ added in v1.2.0
SendSigintOrCtrlC is the same as SendSigintOrCtrlCWithContext with background context.
func SendSigintOrCtrlCWithContext ¶ added in v1.2.0
SendSigintOrCtrlCWithContext sends SIGINT on POSIX and CTRL_C_EVENT on Windows to process with PID `pid` using context `ctx`.
func SendSignal ¶
SendSignal is the same as SendSignalWithContext with background context.
func SendSignalWithContext ¶
SendSignalWithContext sends signal `sig` to the process with PID `pid` using context `ctx`.
func WaitForProcStop ¶
WaitForProcStop returns when process with PID `pid` is no longer running or `ctx` deadline exceedes.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
posix/external_pid_sigint
command
|
|
|
posix/same_terminal
command
|
|
|
windows/external_pid_ctrlc
command
|
|
|
windows/process_group
command
|
|
|
windows/same_terminal
command
|
|
|
windows/tree
command
|
|
|
internal
|
|
|
proxy
command
|
|