Categorygithub.com/SCP002/terminator
modulepackage
1.0.0
Repository: https://github.com/scp002/terminator.git
Documentation: pkg.go.dev

# README

terminator

Library to stop processes gracefully, even on Windows.

Capabilities

On Windows it can:

  • Send Ctrl + C to console applications
  • Send Ctrl + Break to console applications
  • Close graphical applications as if it's window was closed
  • Send messages to standard input of console applications to answer the questions such as "Y/N?"

On Linux / Mac it can:

  • Send signals (SIGINT, SIGKILL etc.) to terminal applications
  • Send messages to standard input of terminal applications to answer the questions such as "Y/N?"

Usage

See examples folder and info on go packages.

# Packages

No description provided by the author

# Functions

FlatChildTree returns gopsutil Process instances of all descendants of a process with the specified PID `pid`.
Kill is the same as KillWithContext with background context.
KillWithContext kills process with PID `pid` using context `ctx`.
SendMessage is the same as SendMessageWithContext with background context.
SendMessageWithContext writes a `msg` message to the console process with PID `pid` using context `ctx`.
SendSignal is the same as SendSignalWithContext with background context.
SendSignalWithContext sends signal `sig` to the process with PID `pid` using context `ctx`.
SendSigTerm is the same as SendSigTermWithContext with background context.
SendSigTermWithContext sends SIGTERM signal to the process with PID `pid` using context `ctx`.
WaitForProcStop returns when process with PID `pid` is no longer running or `ctx` deadline exceedes.